in reply to <solved> fork, but not waiting on children
I'd suggest using waitpid, even though your intention is NOT to wait for the child process.
You spawn the job, wait 1 second, and then check the waitpid return value. If it's -1, you report that the job exited with an error. If it's 0, the job is running - and now you spawn a child to periodically check the return value of the waitpid until it's !=0.
I'll try to update the comment with a code example, just give me a while. Oh, and be sure to invoke waitpid in a nonblocking way,
waitpid($pid, WNOHANG);
regards,
Luke Jefferson
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fork, but not waiting on children
by Monk::Thomas (Friar) on Sep 23, 2014 at 17:53 UTC | |
by blindluke (Hermit) on Sep 23, 2014 at 18:39 UTC | |
by Monk::Thomas (Friar) on Sep 25, 2014 at 08:06 UTC |