in reply to Executing perl script from perl script.

Could p1 just set "alarm 180;" and have the signal handler do the "kill p2 if it still running" stuff?
  • Comment on Re: Executing perl script from perl script.

Replies are listed 'Best First'.
Re^2: Executing perl script from perl script.
by almut (Canon) on Apr 22, 2009 at 13:59 UTC

    The problem with this standard approach is that it may leave orphaned children behind. Unless you set up a process group, you have no single 'handle' to all the processes that belong together. You only have the PID of the parent process that P1.pl directly created, but not of its children and grandchildren, etc. (and it's non-trivial, or at least cumbersome, to find them out).

    So what you would kill is just that one process. And there's no guarantee whatsoever that it will take care of 'cleaning up' by itself...