Skip to main content
4 events
when toggle format what by license comment
Aug 25, 2019 at 17:01 comment added Stéphane Chazelas @philraj, in zsh, you can install handlers on SIGCHLD which are processed upon termination of asynchronous jobs and use $jobstate/$jobtext to inspect process status there. Not without race as the child is already reaped at the time the trap is executed, but that means very short race windows where pids are very unlikely to already be reused.
Aug 25, 2019 at 16:48 comment added philraj Yep I was aware of your second point, and that if you want to make a reliable background process manager you need to use a language that guarantees you will know the exact moment when a child process has exited and its PID has been returned to the pool, which apparently shell scripts cannot since they reap child processes aggressively. Thank you for the clear explanation.
Aug 25, 2019 at 16:44 vote accept philraj
Aug 25, 2019 at 9:26 history answered Stéphane Chazelas CC BY-SA 4.0