[Haskell-cafe] Strange exit status behavior from the process package

Michael Xavier michael at michaelxavier.net
Sun Sep 22 05:12:49 CEST 2013

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:

module Main (main) where

import Control.Concurrent (threadDelay)
import System.Process (createProcess, proc, getProcessExitCode,

main :: IO ()
main = do
  (_, _, _, ph) <- createProcess $ proc "/usr/bin/sleep" ["100"]
  terminateProcess ph
  threadDelay 1000000
  print =<< getProcessExitCode ph

-- prints Just ExitSuccess, should be Just (ExitFailure 143)

term1: sleep 100
term2: pkill sleep
term1: echo $? # 143

Anyone know what might be going on?
Michael Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130921/aa81b1aa/attachment.htm>

More information about the Haskell-Cafe mailing list