Merge pull request #2629 from andresilva/custom-fix-zombie-processes

custom: reap zombie processes on termination
pull/2595/head
Alexis Rouillard 2023-11-02 10:12:21 +01:00 committed by GitHub
commit 7dfc72003f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -112,6 +112,10 @@ inline FILE* open(const std::string& cmd, int& pid) {
execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0);
exit(0); exit(0);
} else { } else {
reap_mtx.lock();
reap.push_back(child_pid);
reap_mtx.unlock();
::close(fd[1]); ::close(fd[1]);
} }
pid = child_pid; pid = child_pid;