Two answers:
 1. I think this preserves backwards-compatibility
 2. My code needs a rewrite, will do it this weekend

On Wed, Sep 06, 2006 at 20:34:57 +0200, Juliusz Chroboczek wrote:
> Since exec is now just (exec_ ... Nothing), this changes the effect of
> exec, but in subtly different ways on the two platforms.

exec is backwards compatible (i hope)
----------------------------
I did make an effort to preserve old behaviour, but I might have
screwed some other stuff up on the side:

In the previous exec
 * Redirecting stdin/stdout was obligatory.
 * stderr was systematically redirected to stdout 
 
The new exec, aka exec_ (Just in) (Just out) Nothing
 * Still redirects stdin/stdout (Just and Just)
 * Systematically redirects stderr to stdout

So it _looks_ like this should perform the same exact way, as far as
Unix is concerned.

my code is bad
--------------
That being said, what is alarming to me is that Windows/Unix have
different behaviours (will look into this after the Unix dust settles).

Also, I think I know why stderr behaves in this weird way under Unix.  I
must have confused myself trying to preserve the backwards compatibility
(redirecting stderr to stdout), and to make stderr redirection sane in
other cases (if the caller says don't redirect, don't do it). 

I must have been trying to juggle
 - preserve backwards compatibility for exec (stderr -> stdout)
 - do not redirect stderr if Nothing is passed

It seems my strategy was to "overload" the Nothing, redirecting to
stdout if stdout redirection is set.  If that be case, it was a very
stupid strategy.  I propose what I believe to be a much clearer
solution; just make a three value datatype like

  data StderrRedirect =
    NoRedirect | RedirectToStdout | RedirectTo FilePath

What do you think?

> Oh, by the way, there's some duplicated code in the Unix version,
> which you can get rid of by commuting the two case expressions.

I think the datatype I mentioned above will also kill the redundancy
here.

-- 
Eric Kow                     http://www.loria.fr/~kow
PGP Key ID: 08AC04F9         Merci de corriger mon français.

Attachment: pgpmKnO8YBmmh.pgp
Description: PGP signature

_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to