open( $ResultPipe, "./myprogram 2>&1 |" );
open( $ResultPipe, "./myprogram 2>&1 > /dev/null |" );
You really do not want to deal with them both together as a single stream (even if myprogram is designed so that all STDERR output lines match a consistent pattern), because there's a risk that a single line of STDOUT will be broken up by an intruding STDERR message.open( $ResultPipe, "./myprogram 2> /tmp/err.$$ |" );
You would need to read the part about redirection in the "sh" or "bash" man page to understand (or at least see examples of) the ordering of the redirection operators and their various meanings.
In reply to Re: Capturing STDERR with a pipe
by graff
in thread Capturing STDERR with a pipe
by Duncan Bayne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |