Closed cfconrad closed 2 years ago
The SIG{CHLD} must be setup before we fork(). Otherwise there is a small risk of a race, that the fork already exited before the SIG{CHLD} was set and we end up in a $p->is_running() endless loop.
SIG{CHLD}
$p->is_running()
It is easy to reproduce, just place a sleep 1 before this enable() call here https://github.com/mudler/Mojo-IOLoop-ReadWriteProcess/blob/master/lib/Mojo/IOLoop/ReadWriteProcess.pm#L340
sleep 1
enable()
The
SIG{CHLD}
must be setup before we fork(). Otherwise there is a small risk of a race, that the fork already exited before the SIG{CHLD} was set and we end up in a$p->is_running()
endless loop.It is easy to reproduce, just place a
sleep 1
before thisenable()
call here https://github.com/mudler/Mojo-IOLoop-ReadWriteProcess/blob/master/lib/Mojo/IOLoop/ReadWriteProcess.pm#L340