[darcs-users] RE: Environment variable does not work (especially DARCS_EDITOR)
Benedikt Schmidt
ry102 at rz.uni-karlsruhe.de
Tue Apr 26 01:15:26 UTC 2005
Sorry for taking so long to reply.
On Tue, 2005-04-19 at 11:36 +0100, Simon Marlow wrote:
> On 16 April 2005 20:41, Benedikt Schmidt wrote:
> > module Main where
> > import System.Cmd
> > main = rawSystem "nvi" []
[ patch calling resetNonBlockingFD in runProcess ]
> If we did this, we would also need to re-enable non-blocking mode after
> the rawSystem completes. Also, this doesn't work well if runProcess is
> used and the Haskell program continues to run while the subprocess is
> executing, because the O_NONBLOCK flag is shared between parent and
> child.
I didn't think about the flags beeing shared between parent and child.
I tried using setFdOption first, but didn't see that rawSystem sets
stdin back to blocking mode when stdin is evaluated.
This works for me now with ghc-6.4:
main = do stdin `seq` return ()
bracket (setFdOption stdInput NonBlockingRead False)
(\_ -> setFdOption stdInput NonBlockingRead True)
(\_ -> rawSystem "nvi" [])
> So I suggest doing this for System.Cmd.{system,rawSystem} only.
Would something like that be safe for system and rawSystem if all
arguments where forced before the setFdOption? If there are
several threads?
Benedikt
More information about the darcs-users
mailing list