Improve commenting regarding process groups and builtins.

This commit is contained in:
ridiculousfish 2018-02-02 14:31:10 -08:00
parent 0c18f68cc2
commit 8de266afb4
2 changed files with 3 additions and 5 deletions

View File

@ -489,6 +489,8 @@ static bool exec_internal_builtin_proc(parser_t &parser, job_t *j, process_t *p,
// make exec handle things. // make exec handle things.
const int fg = j->get_flag(JOB_FOREGROUND); const int fg = j->get_flag(JOB_FOREGROUND);
j->set_flag(JOB_FOREGROUND, false); 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); p->status = builtin_run(parser, p->get_argv(), streams);
// Restore the fg flag, which is temporarily set to false during builtin // Restore the fg flag, which is temporarily set to false during builtin

View File

@ -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 /// 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 /// 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 /// 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 /// if it's to run in the foreground.
/// 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.
bool set_child_group(job_t *j, pid_t child_pid) { bool set_child_group(job_t *j, pid_t child_pid) {
bool retval = true; bool retval = true;