2 # Copyright (c) 2014 IndexData ApS. http://indexdata.com
4 # bomb.pl - wrapper to stop a process after N seconds
8 use POSIX ":sys_wait_h";
18 binmode \*STDOUT, ":utf8";
19 binmode \*STDERR, ":utf8";
23 usage: $0 [ options ] command args ....
25 --debug=0..3 debug option, default: $debug
26 --timeout=1..N timeout in seconds, default: $timeout
33 "timeout=f" => \$timeout,
39 die usage if !@system;
42 # use fork/exec instead system()
45 die "fork() failed: $!" unless defined $pid;
50 exec(@system) or die "exec @system: $!\n";