Re: Killing a process that takes too long



On 11/21/06, Jen Spinney <jen.spinney@xxxxxxxxx> wrote:

I want to make a system call, and then kill the process if it takes
too long.

So, if I do a ps -af, I can see that my perl script is a goner, but
the process spawned from the system call is still alive.

Yes; if you use system() to start a sub-process, you're letting perl
manage it; so there's no way to get the process-ID.

You may instead use fork and exec; this lets you use the process-ID to
manage the process directly. Be sure to use wait or waitpid to reap
the completed child process, so as not to leave zombies.

Is that what you needed? Hope this helps!

--Tom Phoenix
Stonehenge Perl Training
.