From 0337588979d71de72e6d7bb96a765d87fd9f4d4a Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 30 Dec 2018 21:44:14 -0600 Subject: [PATCH] fixup! Do not use up the ~WNOHANG waitpid call on completed processes --- src/proc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/proc.cpp b/src/proc.cpp index 7f5f37b9d..4c824e090 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -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