complete-run: add cleanup sighandler
This commit is contained in:
parent
2d188bfc9b
commit
43b8b8356d
|
@ -55,7 +55,6 @@ my $help = 0;
|
||||||
# num_cores * 2.
|
# num_cores * 2.
|
||||||
my $parallel = undef;
|
my $parallel = undef;
|
||||||
my @displays = ();
|
my @displays = ();
|
||||||
my @childpids = ();
|
|
||||||
|
|
||||||
my $result = GetOptions(
|
my $result = GetOptions(
|
||||||
"coverage-testing" => \$coverage_testing,
|
"coverage-testing" => \$coverage_testing,
|
||||||
|
@ -75,7 +74,8 @@ pod2usage(-verbose => 2, -exitcode => 0) if $help;
|
||||||
if (@displays == 0) {
|
if (@displays == 0) {
|
||||||
my ($displays, $pids) = start_xdummy($parallel);
|
my ($displays, $pids) = start_xdummy($parallel);
|
||||||
@displays = @$displays;
|
@displays = @$displays;
|
||||||
@childpids = @$pids;
|
|
||||||
|
push our @CLEANUP, sub { kill(15, $_) for @$pids };
|
||||||
}
|
}
|
||||||
|
|
||||||
# connect to all displays for two reasons:
|
# connect to all displays for two reasons:
|
||||||
|
@ -147,7 +147,7 @@ $harness->summary($aggregator);
|
||||||
|
|
||||||
close $log;
|
close $log;
|
||||||
|
|
||||||
kill(15, $_) for @childpids;
|
cleanup();
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
@ -222,6 +222,13 @@ sub take_job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
$_->() for our @CLEANUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
# must be in a begin block because we C<exit 0> above
|
||||||
|
BEGIN { $SIG{$_} = \&cleanup for qw(INT TERM QUIT KILL) }
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
Loading…
Reference in New Issue