[Haskell] rawSystem unpredictable with signals
John Goerzen
jgoerzen at complete.org
Tue Jul 4 11:47:13 EDT 2006
Hi,
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.
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.
I will probably write my own rawSystem replacement, that returns a
ProcessStatus, and put it in MissingH.Cmd.
-- John
More information about the Haskell
mailing list