Check out the open3()

Adam Frielink

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Jerry Veldhuis
> Sent: Wednesday, January 23, 2002 2:50 PM
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] open with separate filehandles for stdout and
> stderr of shell command
> 
> 
> 
> I'd like to invoke a shell command:
> 
>    open(CVSOUT, "cvs status -q 2>&1 |") || die "darn: $!";
> 
> problem is this mixes stdout and stderr messages.
> In a perfect world, I'd like to have a separate filehandle
> for the stdout and another for stderr output.
> 
> I've tried
>    open(CVSOUT, "(cvs status | perl -pe 'print \"hi:\";') 2>&1 | ");
>    while(<CVSOUT>) {
>       # remove stdout messages to see if it works.
>       print if ( ! m/^hi:/o );
>    }
>    close(CVSOUT);
> 
> but the 2>&1 causes stdout/stderr to be a mixed as well.
> 
> Yes, I do realize I could redirect stderr to a file, but I'd rather
> not do it that way.
> 
> Can I temperarily redirect my own STDERR or something ?
> Any ideas ?
> jerry
> 
> _______________________________________________
> Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users


_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to