X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=test%2Fbin%2Fbomb.pl;h=2dde3d48f37ec1012e98d627f01f2c1db5da628f;hp=f4b4cec28a1b66b298f89ce1ba4dec1d6e61be82;hb=e037fab727a9eb80c33f1693fcd6d0b67b84da32;hpb=6e888e413ec6754c540988844dd5fdfde39f61c0 diff --git a/test/bin/bomb.pl b/test/bin/bomb.pl index f4b4cec..2dde3d4 100755 --- a/test/bin/bomb.pl +++ b/test/bin/bomb.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl -# Copyright (c) 2014 IndexData ApS. http://indexdata.com +# Copyright (c) 2014 Index Data ApS. http://indexdata.com # # bomb.pl - wrapper to stop a process after N seconds # use Getopt::Long; +use POSIX ":sys_wait_h"; use strict; use warnings; @@ -12,39 +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 - # and kill running java processes - local $SIG{HUP} = "IGNORE"; - kill 1, -$$; - - local $SIG{TERM} = "IGNORE"; - kill 15, -$$; - kill 15, -$$; - - warn "Send a hang-up to all childs.\n"; - - #exit 1; - }; - - warn "set alarm time to: $time seconds $message\n" if $debug >= 1; - alarm($time); -} - sub usage () { <