There is nothing wrong with your syntax for redirecting STDOUT & STDERR to the same file.
P:\test>perl -e"print 'This goes to stdout', $/; print STDERR 'This go +es to STDERR', $/;" 1>junk.log 2>&1 P:\test>type junk.log This goes to STDERR This goes to stdout
One caveat is that in common with several other POSIX systems, you need to do this in the right order; that shown above. The other way around does not do the same thing.
The other caveat, also common to many systems, is that depending upon the buffering stratecies used internally by the program you are running, you may find that the output from the two streams is not correctly interleaved. Often this shows up as STDERR output showing up before STDOUT lines, with the latter tending to come bunched together in blocks. This is because STDOUT os often buffered whereas STDERR is not. You'll notice in the above example the STDERR line precedes the STDOUT line.
If the programs/commands in question are other perl scripts then you can correct this by disabling buffering on STDOUT, but if they are programs written in C (or other languages) to which you do not have the source, there is little or nothing you can do about this.
In reply to Re: Re: Re: Re: Re: Can't spawn "cmd.exe": No error at
by BrowserUk
in thread Can't spawn "cmd.exe": No error at
by mgibian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |