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
In reply to Timeout on system command by MorgothSauron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |