d57d7e1d14d29f6f741f80ab6118a0da58006ab5 — Simon Ser 2 months ago e0a06c0
Improve docs
3 files changed, 11 insertions(+), 2 deletions(-)

M include/mrsh/shell.h
M include/shell/job.h
M shell/task/pipeline.c
M include/mrsh/shell.h => include/mrsh/shell.h +4 -0
@@ 120,6 120,10 @@ int mrsh_run_program(struct mrsh_state *state, struct mrsh_program *prog);
  int mrsh_run_word(struct mrsh_state *state, struct mrsh_word **word);
  bool mrsh_run_arithm_expr(struct mrsh_arithm_expr *expr, long *result);
+ /**
+  * Enable or disable job control. This will setup signal handlers, process
+  * groups and the terminal accordingly.
+  */
  bool mrsh_set_job_control(struct mrsh_state *state, bool enabled);
  
  #endif

M include/shell/job.h => include/shell/job.h +4 -1
@@ 40,7 40,7 @@ * - TASK_STATUS_STOPPED if the job is stopped (ie. one or more processes are
   *   stopped, all the others are terminated)
   * - An integer >= 0 if the job has terminated (ie. all processes have
- *    terminated)
+  *   terminated)
   */
  int job_poll(struct mrsh_job *job);
  /**


@@ 50,6 50,9 @@ /**
   * Put the job in the foreground or in the background. If the job is stopped and
   * cont is set to true, it will be continued.
+  *
+  * It is illegal to put a job in the foreground if another job is already in the
+  * foreground.
   */
  bool job_set_foreground(struct mrsh_job *job, bool foreground, bool cont);
  

M shell/task/pipeline.c => shell/task/pipeline.c +3 -1
@@ 102,7 102,9 @@   	if (!tp->started) {
  		// When simple commands will be started, we want them to be in the same
- 		// job. However we don't want sibling pipelines to share this job.
+ 		// job. Moreover if we're run from inside a subshell, we want to be in
+ 		// the same job as the subshell. However we don't want sibling pipelines
+ 		// to share this job.
  		if (ctx->job == NULL && !ctx->background) {
  			tp->child_ctx = *ctx;
  			tp->has_child_ctx = true;