[Haskell-cafe] createProcess shutting file handles

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Feb 15 06:06:01 EST 2009

On Sun, 2009-02-15 at 09:24 +0000, Neil Mitchell wrote:
> Hi
> >> What have I done wrong? Did createProcess close the handle, and is
> >> there a way round this?
> >
> > The docs for runProcess says:
> >
> >        Any Handles passed to runProcess are placed immediately in the
> >        closed state.
> >
> > but the equivalent seems to be missing from the documentation for
> > createProcess.
> However the createProcess command structure has the close_fds flag,
> which seems like it should override that behaviour, and therefore this
> seems like a bug in createProcess.

        close_fds :: Bool
        Close all file descriptors except stdin, stdout and stderr in
        the new process

This refers to inheriting open unix file descriptors (or Win32 HANDLEs)
in the child process. It's not the same as closing the Haskell98 Handles
in the parent process that you pass to the child process.


More information about the Haskell-Cafe mailing list