in reply to WHy error message is printed in STDOUT?

The error message isn't sent to STDOUT. It's sent to STDERR what, for the windows shell, is the same as STDOUT (With the difference that shell piping does not work as expected.)

See Re: catching STDERR of a system(@callout).


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: WHy error message is printed in STDOUT?
by johngg (Canon) on Apr 12, 2006 at 13:01 UTC
    Perhaps I'm being stupid but it looks to me like the message is going to STDOUT because print has been used rather than warn or print STDERR. Feel free to tell me I am stupid if I have missed something obvious.

    Cheers,

    JohnGG

      The command in the backticks, not your script, is the thing printing to stderr.

      In Unix, you could capture the stderr by redirecting stderr to also go to stdout, like this:

      $output = `$cmd 2>&1`
      That says "put the stuff going to file descriptor 2 (stderr) into file descriptor 1 (stdout)".

      I'm not sure how all that works on Windows.

        You forgot to tell me I'm stupid! I think this is known as "can't see the wood for the trees" syndrome.

        Oh dear!

        JohnGG