Skip to content

Commit affdd50

Browse files
committed
Reap leftover zombie processes
1 parent c1a8669 commit affdd50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/executor/Executor.cc

+5
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ void Executor::executeParent() {
190190
for (auto& listener: eventListeners_) {
191191
listener->onPostExecute();
192192
}
193+
// This is needed, as most earlier waits have the WNOWAIT flag.
194+
if (waitpid(-1, NULL, WNOHANG) == -1 && errno != ECHILD) {
195+
throw SystemException(
196+
std::string("final waitpid failed: ") + strerror(errno));
197+
}
193198
}
194199

195200
void Executor::setupSignalHandling() {

0 commit comments

Comments
 (0)