[Haskell-cafe] Re: Bug in runInteractiveProcess?

John Goerzen jgoerzen at complete.org
Wed Oct 17 16:11:28 EDT 2007

On 2007-10-17, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> Note that forkProcess doesn't currently work with +RTS -N2 (or any value 
> larger than 1), and it isn't likely to in the future.  I suspect 
> forkProcess should be deprecated.

That would be most annoying, and would render HSH unable to function
without using FFI to import fork from C.  I suspect that forkProcess has
some more intelligence to it than that, though I haven't looked.

System.Process is not powerful enough to do serious work on POSIX, and
perhaps it never can be.  The mechanism for setting up a direct pipeline
with more than 2 processes is extremely inconvenient at best, and it
does not seem possible to create n-process pipelines using
System.Process without having to resort to copying data in the Haskell
process at some point.  (This even putting aside the instant bug)

Not only that, but the ProcessHandle system doesn't:

 * Let me get the child process's PID
 * Send arbitrary signals to the child process
 * Handle SIGCHLD in a custom and sane way
 * Get full exit status information (stopped by a particular signal,

Now, there are likely perfectly valid cross-platform reasons that it
doesn't do this.  I am merely trying to point out that removing
forkProcess in favor of System.Process will shut out a large number of
very useful things.

Don't forget either that there are a whole class of programs whose
multithreading needs may be better addressed by forkProcess,
executeFile, and clever management of subprograms rather than by a
threaded RTS.

forkProcess, with the ability to dupTo, closeFd, and executeFile is
still mighty useful in my book.

More information about the Haskell-Cafe mailing list