[Haskell-cafe] Re: exitFailure under forkProcess

Peter Simons simons at cryp.to
Tue Oct 26 18:06:13 EDT 2004


John Goerzen writes:

 > (progname): forkProcess: uncaught exception

Quoting from the documentation:

  forkProcess :: IO () -> IO ProcessID

  [...] On success, forkProcess returns the child's
  ProcessID to the parent process; in case of an error, an
  exception is thrown.

What I assume is happening is this: The child terminates
_right away_, with a non-success error code, no less. And my
guess is that forkProcess interprets this as the /fork/
having failed and throws an exception.

The following program, for example, works fine:

> import System.Exit
> import System.Posix.Process
> import Control.Concurrent
> main = forkProcess (threadDelay (10*1000000) >> exitFailure)

Peter



More information about the Haskell-Cafe mailing list