----- Original Message -----
From: "Jerry Veldhuis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 23, 2002 3:50 PM
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 ?
You've already re-directed STDERR with "2>&1". The question is,
where do you want it to go?

> Any ideas ?
> jerry


Edward G. Orton, GWN Consultants Inc.
Phone: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]

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

Reply via email to