[darcs-devel] darcs patch: Exec improvements : Windows
redirection, and more redi...
Eric Y. Kow
eric.kow at gmail.com
Thu Sep 7 13:30:22 PDT 2006
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20060907/3e497a7e/attachment.pgp
More information about the darcs-devel
mailing list