Commit fc000997 authored by Leigh B Stoller's avatar Leigh B Stoller

Add alarm on read from child; sometimes we do not get notification of

the close (child has exited) and we hang out forever. Not sure why
this happens but probably related to all of the file descriptor
messing about. Needs more investigation.
parent 85cb6895
......@@ -220,10 +220,23 @@ if ($pid) {
close WRITER;
close STDOUT;
close STDIN;
# The read seems to get stuck, leaving a defunct child and this
# script hanging out. Not sure why, so cancel the read after a
# a bit and go on.
local $SIG{ALRM} = sub {
info("Timed out waiting for $pid to say something");
waitpid($pid, 0);
info("After waitpid: $?");
exit($? >> 0);
alarm 30;
while (<READER>) {
info("Before waitpid");
alarm 0;
info("Before waitpid for $pid");
waitpid($pid, 0);
info("After waitpid: $?");
exit($? >> 0);
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