Proposal: overhaul System.Process

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Apr 22 19:01:24 EDT 2008


On Tue, 2008-04-22 at 15:19 -0700, Simon Marlow wrote:
> I've made some improvements to System.Process that I'd like to get 
> feedback on.  Everything so far is backwards compatible in the sense 
> that I've only added to the API - everything that was there before is 
> still available, with the same semantics (except where bugs have been 
> fixed).
> 
> Haddock for the proposed new System.Process:
> 
>    http://darcs.haskell.org/~simonmar/process/System-Process.html

Looks good.

> Summary of changes:
> 
> Tue Apr 22 15:02:16 PDT 2008  Simon Marlow <simonmarhaskell at gmail.com>
>    * Overhall System.Process
> 
>     - fix #1780: pipes created by runInteractiveProcess are set
>       close-on-exec by default
> 
>     - add a new, more general, form of process creation: createProcess
>       Each of stdin, stdout and stderr may individually be taken
>       from existing Handles or attached to new pipes.  Also it
>       has a nicer API.

Yay!

>     - add readProcess from Don Stewart's newpopen package.  This
>       function behaves like C's popen().

I'll double check that we can use this in Cabal where we currently have
to implement something similar using #ifdef, doing it differntly for ghc
vs nhc/hugs due to different compilers implementing different apis and
the ghc api not being usable without pre-emptive threads (iirc).

Our current function is :: FilePath -> [String] -> IO (String, ExitCode)

So that connects stdin to /dev/null, I expect we can implement that in
terms of the new createProcess.

>     - Move System.Cmd.{system,rawSystem} into System.Process.  Later
>       we can depecate System.Cmd.

Do you suppose we can rename the system/rawSystem given that we're
already moving them from one module to another?

Just off the top of my head, how about "runShellCommand" & "runProgram",
better suggestions welcome.

>     - Don't use O_NONBLOCK for pipes, as it can confuse the process
>       attached to the pipe (requires a fix to GHC.Handle in the base
>       package).
> 
>     - move the tests from the GHC testsuite into the package itself,
>       and add a couple more
> 
>     - bump the version to 2.0




More information about the Libraries mailing list