X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fbin%2Fbomb.pl;h=6211eab85b49ac4067eeac8dfdc84f6b2ae76b29;hb=ea0fe869ce52ffafe524d8a8c70ff8b725a45daa;hp=5671a53d0d65e5ef9b37a9d7f9305a096d7263fb;hpb=87d282b5e8d01e9b38aed892cd8d021d3de84327;p=mkws-moved-to-github.git diff --git a/test/bin/bomb.pl b/test/bin/bomb.pl index 5671a53..6211eab 100755 --- a/test/bin/bomb.pl +++ b/test/bin/bomb.pl @@ -5,6 +5,7 @@ # use Getopt::Long; +use POSIX ":sys_wait_h"; use strict; use warnings; @@ -12,38 +13,11 @@ use warnings; my $debug = 0; my $help; my $timeout = 100; +my $pid; binmode \*STDOUT, ":utf8"; binmode \*STDERR, ":utf8"; -# timeout handler -sub set_alarm { - my $time = shift; - my $message = shift || ""; - - $time = 100 if !defined $time; - - $SIG{ALRM} = sub { - - warn "Time out alarm $time\n"; - - # sends a hang-up signal to all processes in the current process group - local $SIG{HUP} = "IGNORE"; - kill 1, -$$; - sleep 0.2; - - local $SIG{TERM} = "IGNORE"; - kill 15, -$$; - sleep 0.2; - kill 15, -$$; - - warn "Send a hang-up to all childs.\n"; - }; - - warn "set alarm time to: $time seconds $message\n" if $debug >= 1; - alarm($time); -} - sub usage () { <