mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-27 03:51:22 -03:00
Do not use up the ~WNOHANG waitpid call on completed processes
This is the more correct fix for #5447, as regardless of which process in the job (be it the first or the last) finished first, once we have waited on a process without ~WNOHANG we don't do that for any subsequent processes in the job. It is also a waste to call into the kernel to wait for a process we already know is completed!
This commit is contained in:
@@ -478,6 +478,11 @@ static bool process_mark_finished_children(bool block_on_fg) {
|
||||
break;
|
||||
}
|
||||
assert((*process)->pid != INVALID_PID && "Waiting by process on an invalid PID!");
|
||||
if ((*process)->completed) {
|
||||
// This process has already been waited on to completion
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((options & WNOHANG) == 0) {
|
||||
debug(4, "Waiting on individual process %d", (*process)->pid);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user