Commit f3917894 authored by Leigh Stoller's avatar Leigh Stoller

Minor tweaks to make sure child is actually killed.

parent 2c871e76
......@@ -1729,29 +1729,23 @@ END {
info("Recursive call to END block. Returning ...\n");
return;
}
if (!defined($eventchild)) {
#
# No eventchild, nothing interesting happening.
#
if (defined($eventchild) && $eventchild == 0) {
# We are the event child; just exit.
return;
}
$ending = 1;
debug("Ending stated...\n");
my $stat = $?;
$lastmail=0;
notify("",1);
if (defined($lockfile) && $lockfile ne "") {
unlink $lockfile;
announce("Stated exiting, cleaning up\n");
} else {
# Must be a child
info("Stated child exiting\n");
}
announce("Stated exiting, cleaning up\n");
debug("Announced. Cleaning up...\n");
if ($eventchild) {
if (defined($eventchild) && $eventchild) {
debug("Killing event reader child ...\n");
if (! kill('TERM', $eventchild)) {
info("Could not kill event reader child\n");
announce("Could not kill event reader child: $eventchild\n");
}
}
debug("Cleaned up. Bye!\n");
......@@ -1820,6 +1814,12 @@ sub StartEvents()
# We want to exit on any warning. Let the caller notice.
$SIG{__WARN__} = sub { print STDERR $_[0]; exit(-1); };
# Plain exit in the child.
$SIG{TERM} = sub {
print STDERR "Caught a TERM in child. Exiting ...\n";
exit(0);
};
# Make sure this child starts writing into the new logfile.
$SIG{USR2} = sub {
print STDERR "Caught a USR2 in child\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment