|XP is just a number|
YA fork() question: catching runaway and erroneous processesby stefan k (Curate)
|on Jul 28, 2004 at 07:16 UTC||Need Help??|
stefan k has asked for the wisdom of the Perl Monks concerning the following question:
once again yet another fork()-question is posted. I definetely think there should be a tutorial around but I couldn't find any. And reading man perlipc didn't make me much smarter, too. Thus here I go...
The problem is: I need to start a program that is known to hang from time to time and to crash at other times. Well, OK, sometimes it works, too :-)
What I did so far is: loop over a certain amount of tries, each time fork and excute the program in the child while the parent process waits for a maximum amount of time, eventually killing the child. Speaking in code:
The problem with this solution is that I don't get any information whether the program exited with an error or not. Substituting the exec for a system resulted in many processes hanging in the process table.
Can you give me any clues?