[Haskell] Re: rawSystem unpredictable with signals

Simon Marlow simonmarhaskell at gmail.com
Thu Jul 6 06:42:13 EDT 2006


John Goerzen wrote:

> I'm using System.Cmd.rawSystem in a program and have noticed a
> mysterious flaw:
> 
> When I hit Ctrl-C while the child process is running, sometimes:
> 
>   1) rawSystem returns ExitSuccess
> 
> or
> 
>   2) rawSystem raises an IOError saying the child terminated with a
>   signal
> 
> I am totally at a loss as to explain this difference in behavior.  I
> would prefer it to choose option #2 always.

Would you like to submit a bug report on this, I'll try to get to it 
before GHC 6.6.

> However, even that is not quite ideal.  It seems like it would be much
> better if ExitCode would be replaced with
> System.Posix.Process.ProcessStatus, which can indicate an Exited (with
> exit code), Terminated by signal, or Stopped by signal status.  Getting
> an exception when the child was terminated by a signal, but not when it
> exits with a failure, seems inconsistent.

The problem with this is that not all platforms are POSIX, and 
System.Process is trying to be platform-independent.  Having a more 
elaborate version of System.Process under System.Posix.Process would be 
an option, though.  You can reuse some of the bits from 
System.Process.Internals.

Cheers,
	Simon


More information about the Haskell mailing list