in reply to IPC::Run not seeing exit of short child run with long timeout

The problem is that you are not having IPC::Run manage any I/O. If you set the timeout to a large value (like 20000), run your program and do an strace on the perl process you'll see that IPC::Run is stuck in the following select call:
$ strace -p1625 Process 1625 attached - interrupt to quit select(0, NULL, NULL, NULL, {19943, 944000}
Just change your code so that some pipe between parent and child is closed when your child exits. Then IPC::Run will notice your child's exit. Example:
use IPC::Run qw(run timeout timer); my $t = timeout(20000); my $out; run(debug => 1, ["/bin/sleep", 5], '>', \$out, $t);
Update: Another solution is to simply install a CHLD signal handler. It doesn't have to do anything -- the mere fact that the signal is not ignored will cause the select call to be interrupted:
$SIG{CHLD} = sub {}; run(["/bin/sleep", 5], timeout(20000));

Replies are listed 'Best First'.
Re^2: IPC::Run not seeing exit of short child run with long timeout
by wildSmurf (Initiate) on Mar 15, 2008 at 01:09 UTC
    How wise you are. It works better that way. I was hoping for a more system()-ish output rather than accumulating it all and then dumping it all, but I can make a filter for that, I think.