How should I clean up hung grandchild processes when an alarm trips in Perl?
I have a parallelized automation script which needs to call many other scripts, some of which hang because they (incorrectly) wait for standard input or wait around for various other things that aren't going to happen. That's not a big deal because I catch those with alarm . The trick is to shut down those hung grandchild processes when the child shuts down. I thought various incantations of SIGCHLD , waiting, and process groups could do the trick, but they all block and the grandchildren aren't reaped. My solution, which works, just doesn't seem like it is the right solution. I'm not