|No such thing as a small change|
Re^3: Monitoring Child Processby Marshall (Prior)
|on Oct 19, 2011 at 20:08 UTC||Need Help??|
Oh, I guess a mis-communication. I updated my post with a more detailed suggestion. This foreach(@all_kids) code is that part should be deleted!
The REAPER is part of the parent. So having waitpid() in only one place means having it only in REAPER().
Some replacement code to this foreach (@all_kids) loop:
You can also just sleep(20) and print @dead_kids. The focus right now should be on getting this to work without the CTL-C complication and then add that later.
Update: Oh, I would also add use warnings; either by that statement, or a -w in the hash bang line. This has nothing to do with your current woes, but there are run time checks with warnings enabled that are useful. I leave them on unless some rare, very rare performance or other reason indicates otherwise.
Another Update: Was able to test some code...for some reason, when SIGCHLD happens, this causes the sleep to end. I don't know why. So there is a loop to restart the sleep every 1 seconds. try this code...have to run to an appointment...oh, exit 1 was caused by missing parens in while statement in the reaper. The sleep issue is the real puzzle here.
update: added readmore tag - updated code in later post