MorgothSauron has asked for the wisdom of the Perl Monks concerning the following question:
I do receive the timeout message as expected. However, the command that was started is still running in the background. How to 'kill' the command if the timeout is reached ? If using 'fork', how can I get the output of my command ? I also need the output of the command. Any suggestion ? Thanks.$TIMEOUT = 5; $CMD = $ARGV[0]; eval { $SIG{ALARM} = sub { die "TIMEOUT\n" }; alarm $TIMEOUT; system($CMD); alarm 0; }; # do error processing
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Timeout on system command
by revdiablo (Prior) on Jul 06, 2004 at 20:22 UTC | |
|
Re: Timeout on system command
by Joost (Canon) on Jul 06, 2004 at 20:12 UTC | |
|
Re: Timeout on system command
by edan (Curate) on Jul 07, 2004 at 11:00 UTC | |
|
Re: Timeout on system command
by eyepopslikeamosquito (Archbishop) on Jul 07, 2004 at 09:06 UTC |