On 7/7/22 14:21, Klemens Morgenstern via Boost wrote:
I don't think this is a solvable problem. The reason is that you need to set SIGCHLD to SIGIGN for the whole application in order to prevent zombies. Doesn't really work as a general solution, which is why I'll deprecate that function at some point.
You can probably `waitpid(-1, &status, 0); from time to time to reap the zombie processes or you can put them in a process group; but I couldn't come up with a satisfying solution, which is why the only way will be to just hold a handle to the child process.
Isn't SIGCHLD main purpose exactly to call waitpid? If anything, you should be recommending to either plug a Boost.Process API call in user's SIGCHLD handler (that will call waitpid internally) or allow the user to set Boost.Process' own SIGCHLD handler that will do this. Ignoring SIGCHLD does not seem like a right thing to do. If Boost.Process doesn't allow to join terminated processes as they terminate, this seems like a major design flaw to me. Asking users to call waitpid periodically sounds like a kludge.