- print "Timed out $pid.\n";
- print "not killed\n" if !kill ('SIGTERM', $pid);
- $status = 0;
- }
+ print "Timed out: ";
+ for (my ($i) = 0; $i < 10; $i++) {
+ kill ('SIGTERM', $pid);
+ sleep (1);
+ my ($retval) = waitpid ($pid, WNOHANG);
+ last if $retval == $pid || $retval == -1;
+ print "Waiting for $pid to die" if $i == 0;
+ print ".";
+ }
+ $ok = 1;
+ } else {
+ if (WIFSIGNALED ($status)) {
+ my ($signal) = WTERMSIG ($status);
+ die "Interrupted\n" if $signal == SIGINT;
+ print "Child terminated with signal $signal\n";
+ }