redirect STDERR to STDOUT ????? 
Author Message
 redirect STDERR to STDOUT ?????

How can I redirect STDERR to STDOUT?

Problem: some programs put their error messages to STDERR and not to
STDOUT. In these cases I can't get the error messages in PERL.

The following example should work with outputs of program prog
to STDOUT _and_ STDERR or at least STDERR:



Sat, 25 Nov 1995 17:59:30 GMT  
 redirect STDERR to STDOUT ?????

   How can I redirect STDERR to STDOUT?

   Problem: some programs put their error messages to STDERR and not to
   STDOUT. In these cases I can't get the error messages in PERL.

   The following example should work with outputs of program prog
   to STDOUT _and_ STDERR or at least STDERR:


I think this problem have been discussed just a couple of weeks ago but I can't
find the final conclusion right now.

Just as a temporary hack,  what aboud using:


I call this "temporary" since as far as I reckon perl will NOT call the shell
in your case but it WILL call the shell in my 'hack'.

The other, and most efficient, solution I can come up is a fork/reopen/exec
sequence.

Hope this helps,

--Amos

--
--Amos Shapira (Jumper Extraordinaire) |  "It is true that power corrupts,
C.S. System Group, Hebrew University,  |   but absolute power is better!"
Jerusalem 91904, ISRAEL                |



Wed, 29 Nov 1995 06:16:37 GMT  
 redirect STDERR to STDOUT ?????

:   How can I redirect STDERR to STDOUT?
:

:
:
:I think this problem have been discussed just a couple of weeks ago but I can't
:find the final conclusion right now.
:
:Just as a temporary hack,  what aboud using:
:

No no no.  That's the Evil Shell's syntax, which won't work in perl
unless you've a really weird /bin/sh installed.

You want  `prog 2>&1` instead.  If you don't want the shell to do it,
you must do it yourself:

    open(PREVERR, ">&STDERR");
    open(STDVERR, ">&STDOUT");

    open(STDERR, ">&PREVERR");
    close PREVERR;

--tom



Thu, 30 Nov 1995 21:37:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. redirecting stderr and stdout

2. Redirect stderr to stdout w/ Perl under Unix?

3. Redirecting STDERR to STDOUT (on NT)

4. Redirecting STDERR to STDOUT?

5. redirecting stderr to stdout

6. redirect stderr and stdout to same file

7. redirect stderr and stdout to the same file

8. Redirect stderr to stdout inside perl script

9. Redirecting stderr to stdout

10. how to redirect stderr and stdout to same file

11. How do I redirect STDERR and STDOUT?

12. Redirecting STDERR to STDOUT

 

 
Powered by phpBB® Forum Software