| 1 | #!/usr/local/bin/perl -w | ||||||||||
| 2 | 2 | ▶ | use System::Timeout qw(timeout); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | { | ||||||||||
| 5 | 2 | my $timeout = shift @ARGV; | |||||||||
| 6 | 2 | ▶ | last unless $timeout; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | my ($secs) = $timeout =~ /--timeout=(\d+)$/; | |||||||||
| 9 | 2 | ▶ | last unless($secs); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | my $r = timeout($secs, @ARGV); | |||||||||
| 12 | 2 | exit $r; | |||||||||
| 13 | } | ||||||||||
| 14 | 0 | print "Usage: ./timeout --timeout=[SECONDS] [COMMAND] \n"; | |||||||||
| 15 | 0 | exit -1; | |||||||||