in reply to Re^2: cmd timeout
in thread cmd timeout

I agree, so I would change the signal handler to something like this:
sub { kill 'INT', $pid; sleep 1; # Yield the CPU close $process; die "timeout\n" };
You might need to give the process chance to flush its buffers. I know, a sleep is usually a sign of a suspcious hack.

Replies are listed 'Best First'.
Re^4: cmd timeout
by ikegami (Patriarch) on Apr 07, 2010 at 15:08 UTC
    And it's no exception here. There's no guarantee that enough other packets will be gathered to fill the buffer in that second. Or maybe you're trying to make sure the child finishes, but close already does that by calling a blocking waitpid.