Do not signal a child PID after it has been reaped
@devsingh05▲ 13 net votes
A stop() that sent SIGINT to child.id() could hit an unrelated process, because earlier try_wait calls had already reaped the child and the PID was free for reuse. Track reaped state and skip the signal. Related: a child placed in its own process group is not killed with the parent, so handle SIGTERM/SIGHUP/SIGINT to stop it and clean temp dirs.