From: Maik Fischer Date: Sun, 27 Nov 2011 16:59:25 +0000 (+0100) Subject: complete-run: add cleanup sighandler X-Git-Tag: 4.2~198 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=43b8b8356d5be7fe8542679a40a69173c322e2ae;p=i3%2Fi3 complete-run: add cleanup sighandler --- diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 01227106..1cb6dab3 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -55,7 +55,6 @@ my $help = 0; # num_cores * 2. my $parallel = undef; my @displays = (); -my @childpids = (); my $result = GetOptions( "coverage-testing" => \$coverage_testing, @@ -75,7 +74,8 @@ pod2usage(-verbose => 2, -exitcode => 0) if $help; if (@displays == 0) { my ($displays, $pids) = start_xdummy($parallel); @displays = @$displays; - @childpids = @$pids; + + push our @CLEANUP, sub { kill(15, $_) for @$pids }; } # connect to all displays for two reasons: @@ -147,7 +147,7 @@ $harness->summary($aggregator); close $log; -kill(15, $_) for @childpids; +cleanup(); exit 0; @@ -222,6 +222,13 @@ sub take_job { } } +sub cleanup { + $_->() for our @CLEANUP; +} + +# must be in a begin block because we C above +BEGIN { $SIG{$_} = \&cleanup for qw(INT TERM QUIT KILL) } + __END__ =head1 NAME