in reply to Re: capture stdout and stderr from external command
in thread capture stdout and stderr from external command

...reading the command's output all at once before closing the pipe.

The problem with this approach is if the pipe's buffer should fill up, you have a deadlock (i.e. the spawned program doesn't exit because it waits for the buffer to be emptied, but this won't happen because you wait for the program to exit).  Replace echo BOOM with perl -e"print q(x)x1e5" and you can observe the effect.

Replies are listed 'Best First'.
Re^3: capture stdout and stderr from external command
by juster (Friar) on Nov 12, 2011 at 02:55 UTC
    Ah yes you are right. I modified it to use IO::Select before I remembered that select doesn't work in Windows... please disregard my post.

    edit: perlport also says piped opens (i.e. with '|-') don't work on windows. doh!