X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/blobdiff_plain/e39c603ba366d806d6cf25dbaa5f78e54ea1e949..1e967327a9c288b5fff8e9db78b678d2192c5b0e:/continuous/gw-setup/run.pl diff --git a/continuous/gw-setup/run.pl b/continuous/gw-setup/run.pl index d026b12..068c5dd 100755 --- a/continuous/gw-setup/run.pl +++ b/continuous/gw-setup/run.pl @@ -34,7 +34,7 @@ my $status = system((qw(ssh -T glab), $latester)); kill('TERM', -$pid); exit($status >> 8); - +sub kill_boot() { kill('TERM', -$pid) if defined $pid; } sub run_boot() { # die("No boot command") if ($#ARGV eq -1); @@ -42,6 +42,8 @@ sub run_boot() my $bootcmd = "$FindBin::Bin/boot"; + $SIG{INT} = sub { kill_boot(); exit; }; + pipe($boot, $wh) || die("pipe: $!"); my $pid = fork() // die("fork: $!"); if ($pid == 0) { @@ -49,11 +51,11 @@ sub run_boot() # background processes at once close($boot); open(STDERR, ">&", $wh) || die "Can't dup STDERR: $!"; - my $cmd = "$bootcmd | tee /dev/stderr"; + my $cmd = "$bootcmd 2>&1 | tee /dev/stderr"; exec($cmd) || die "Can't exec $cmd: $!"; } close($wh); return $pid; } -END { kill('TERM', -$pid) if defined $pid; } +END { kill_boot(); }