[darcs-devel] darcs patch: Fix Windows stderr non-redirection.
(and 1 more)
Jason Dagit
dagit at codersbase.com
Sat Sep 9 21:24:27 PDT 2006
On 9/9/06, Eric Y. Kow <eric.kow at gmail.com> wrote:
> On Sat, Sep 09, 2006 at 22:10:14 +0200, Tommy Pettersson wrote:
> > Anyway, I had some difficulty reading the code (most of the code
> > in Exec.lhs), so I tried to make it more readable, which (for me
> > at least) means more simple. So I only kept one version of exec (the
> > fancy one, but with the name exec), and used the redirection data type
> > all the way. This is merely a suggestion, for now -- "easy to read" is
> > very subjective.
>
> I think this is an improvement. Thanks!
>
> > I have changed the
> > Windows code too, but have not tried to compile it since I don't
> > have Windows.
>
> I have a trick for that. I just set #define WIN32 (after recording
> the patch so I can easily revert it)
>
> Alright, so this patch is waiting for two things
>
> 1) Eric - find Juliusz's message re: stderr redirection
> (I assume it's not the message where he accepted my patch)
> I would be happy for stderr to NOT be redirected by
> default, but just want to double-check the arguments,
> just to be conservative and avoid changing behaviour
> unless necessary.
>
> 2) A windows user - confirmation or denial
> Windows automatically redirects stderr when stdout is redirected,
> unless stderr is explicitly redirected somewhere.
> (That sounds like a silly behaviour!)
I just used a program:
-----------------
import System.IO
main :: IO ()
main = do hPutStrLn stdout "writing to stdout..."
hFlush stdout
hPutStrLn stderr "writing to stderr..."
hFlush stderr
------------------
And generated the following:
H:\>main.exe
writing to stdout...
writing to stderr...
H:\>main.exe > out.txt
writing to stderr...
H:\>type out.txt
writing to stdout...
H:\>main.exe 2> out2.txt
writing to stdout...
H:\>type out2.txt
writing to stderr...
H:\>main.exe 2>>&1 > out3.txt
writing to stderr...
So from my 2 minute expirement I see it's possible to redirect them
separately but I don't understand how to redirect them at the same
time.
HTH,
Jason
More information about the darcs-devel
mailing list