On Sat, Sep 21, 2013 at 11:12 PM, Michael Xavier
<mich...@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
value.

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 associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to