[Haskell-cafe] Strange exit status behavior from the process package
michael at michaelxavier.net
Mon Sep 23 22:04:16 CEST 2013
Could I trouble you or anyone else to help me implement this feature? I
have some test processes, one that exits cleanly on sigterm and one that
refuses and must be killed abruptly. In some experimentation on GHCi,
things seem to go alright, but in test, either process reports that it has
terminated with 15, which is incorrect.
Relevant implementation code:
I've spent quite a bit of time trying different solutions to this and have
failed to get the tests to pass.
On Sat, Sep 21, 2013 at 9:24 PM, Brandon Allbery <allbery.b at gmail.com>wrote:
> On Sat, Sep 21, 2013 at 11:12 PM, Michael Xavier <
> michael at michaelxavier.net> wrote:
>> I've run into some strangeness with the process package. When you kill
>> some processes on the command line you correctly get a non-zero exit
>> status. However when using the process package's terminateProcess (which
>> sends a SIGTERM), it returns an ExitSuccess:
> The 143 you get from the shell is synthetic (and nonportable). Signals are
> not normal exit codes; WEXITSTATUS is not defined in this case (but often
> will be 0, as seems to be shown here), instead WTERMSIG will be set to the
> signal that terminated the process. The caller should be using WIFEXITED /
> WIFSIGNALED / WIFSTOPPED to determine the cause of the termination and then
> the appropriate WEXITSTATUS / WTERMSIG / WSTOPSIG call to determine the
> It sounds like the createProcess API does not recognize signal exit at
> all, and uses WEXITSTATUS even when it is not valid.
> brandon s allbery kf8nh sine nomine
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe