From 8de266afb45d6a35a82c912e64d0b8cfcb6782cd Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 2 Feb 2018 14:31:10 -0800 Subject: [PATCH] Improve commenting regarding process groups and builtins. --- src/exec.cpp | 2 ++ src/postfork.cpp | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/exec.cpp b/src/exec.cpp index de9c24d9b..4e2f3ed95 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -489,6 +489,8 @@ static bool exec_internal_builtin_proc(parser_t &parser, job_t *j, process_t *p, // make exec handle things. const int fg = j->get_flag(JOB_FOREGROUND); j->set_flag(JOB_FOREGROUND, false); + + // Note this call may block for a long time, while the builtin performs I/O. p->status = builtin_run(parser, p->get_argv(), streams); // Restore the fg flag, which is temporarily set to false during builtin diff --git a/src/postfork.cpp b/src/postfork.cpp index 91becfa17..766681ff5 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -103,11 +103,7 @@ bool child_set_group(job_t *j, process_t *p) { /// guaranteeing the job control process group has been created and that the child belongs to the /// correct process group. Here we can update our job_t structure to reflect the correct process /// group in the case of JOB_CONTROL, and we can give the new process group control of the terminal -/// if it's to run in the foreground. Note that we can guarantee the child won't try to read from -/// the terminal before we've had a chance to run this code, because we haven't woken them up with a -/// SIGCONT yet. This musn't be called as a part of setup_child_process because that can hang -/// indefinitely until data is available to read/write in the case of IO_FILE, which means we'll -/// never reach our SIGSTOP and everything hangs. +/// if it's to run in the foreground. bool set_child_group(job_t *j, pid_t child_pid) { bool retval = true;