fixup! Do not use up the ~WNOHANG waitpid call on completed processes

This commit is contained in:
Mahmoud Al-Qudsi 2018-12-30 21:44:14 -06:00
parent 2ebdcf82ee
commit 0337588979

View File

@ -480,15 +480,17 @@ static bool process_mark_finished_children(bool block_on_fg) {
assert((*process)->pid != INVALID_PID && "Waiting by process on an invalid PID!");
if ((*process)->completed) {
// This process has already been waited on to completion
process++;
continue;
}
if ((options & WNOHANG) == 0) {
debug(4, "Waiting on individual process %d", (*process)->pid);
debug(4, "Waiting on individual process %d: %ls", (*process)->pid, (*process)->argv0());
} else {
debug(4, "waitpid with WNOHANG on individual process %d", (*process)->pid);
}
pid = waitpid((*process)->pid, &status, options);
process++;
} else {
// A negative PID passed in to `waitpid()` means wait on any child in that process