[GHC] #5212: waitForProcess: does not exist (No child processes)
GHC
ghc-devs at haskell.org
Mon Nov 18 00:11:46 UTC 2013
#5212: waitForProcess: does not exist (No child processes)
------------------------------------------------+--------------------------
Reporter: chrisdone | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Runtime System | Version: 7.4.2
Resolution: invalid | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Incorrect result at runtime | (amd64)
Test Case: | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
------------------------------------------------+--------------------------
Changes (by chrisdone):
* cc: simonmar (added)
* status: new => closed
* resolution: => invalid
Comment:
The reason is because XMonad (and presumably some other library I was
using two years ago) installs signal handlers for SIGCHILD:
{{{
import Data.Maybe
import Control.Monad
import System.Posix.Signals
import Control.Monad.Fix
import Control.Exception
import Control.Monad.Extra
import Control.Monad.Trans
import Control.Concurrent
import System.Process
import System.Posix.Process.ByteString
main = do
installSignalHandlers
readProcess "ghc" ["--version"] "" >>= putStrLn
-- | Ignore SIGPIPE to avoid termination when a pipe is full, and SIGCHLD
to
-- avoid zombie processes, and clean up any extant zombie processes.
installSignalHandlers :: MonadIO m => m ()
installSignalHandlers = io $ do
installHandler openEndedPipe Ignore Nothing
installHandler sigCHLD Ignore Nothing
(try :: IO a -> IO (Either SomeException a))
$ fix $ \more -> do
x <- getAnyProcessStatus False False
when (isJust x) more
return ()
}}}
This is pretty annoying because it breaks other uses of readProcess. My
solution was to use a patched version of readProcess which handles
exceptions thrown on waitForProcess. I guess this ticket can be closed…
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5212#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list