in reply to Dying child processes
I see that 2 of the 3 child processes become defunct.
Since you wait for them in a specific order, that's entirely possible and not a problem. You will eventually reap them once the 3rd (1st, really) child finishes.
You could reap them sooner using wait instead of waitpid if you think it is a problem.
By the way, your die will never be reached. When $pid is undef to indicate an error, it is numerically equal to 0.
By the way, you could call exec instead of system (which calls fork, exec and waitpid) in the child.
|
|---|