Changing STDERR for an open pipe statement (How ?) 
Author Message
 Changing STDERR for an open pipe statement (How ?)

I'm still on 5.001 but I don't think that this should affect my
query.

I'd like to stop a programs 'stderr' output appearing on the
screen when I run the program from perl as a pipe, eg

        open(FH,"program |") || die "program ???";

In Bourne shell speak I could run program
        program 2>/dev/null
to get rid of its tiresome messages and that's what I'd like
to do here.

I have tried the following but it didn't do me any good,

        open(SAVEIT,">&STDERR");
        open(STDERR,">/dev/null");
        select(STDERR); $| = 1;
        open(FH,"program |") || die "die die";
                while( <FH> ) { etc etc ;}
        close(STDERR);
        open(STDERR,">&SAVEIT");

Can anyone out there suggest some other way ?
Regards,
Bill
--
____________________________________________________________

Philips Research , Redhill , Surrey , UK



Sun, 11 Jul 1999 03:00:00 GMT  
 Changing STDERR for an open pipe statement (How ?)

Quote:

> I have tried the following but it didn't do me any good,

>         open(SAVEIT,">&STDERR");
>         open(STDERR,">/dev/null");
>         select(STDERR); $| = 1;
>         open(FH,"program |") || die "die die";
>                 while( <FH> ) { etc etc ;}
>         close(STDERR);
>         open(STDERR,">&SAVEIT");

Sorry all,

(Probably should have added a 'close(SAVEIT);'  at the end there)

It does work !
A slight path problem .... hmm ... picked up the unedited version
of the program I was testing, cant even say it was monday morning :-)
--
____________________________________________________________

Philips Research , Redhill , Surrey , UK



Sun, 11 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Piping in stderr when creating a pipe with the open call

2. redirecting stderr in an open statement on WIN32

3. "open" pipe with stderr

4. open a piped command including stderr

5. Directing stderr when opening a pipe?

6. PERLFUNC: open - open a file, pipe, or descriptor

7. PERLFUNC: open - open a file, pipe, or descriptor

8. Perl's open() pukes when trying to open a read-type pipe

9. Piping STDERR

10. reading stdout/stderr using pipes

11. pipes and STDERR

12. Directing stderr and stdout to a pipe

 

 
Powered by phpBB® Forum Software