[GHC] #3317: Ctrl-C is not received during a call to runProcess

GHC trac at galois.com
Sat Jun 20 13:16:12 EDT 2009


#3317: Ctrl-C is not received during a call to runProcess
--------------------+-------------------------------------------------------
Reporter:  judah    |          Owner:          
    Type:  bug      |         Status:  new     
Priority:  normal   |      Component:  Compiler
 Version:  6.10.3   |       Severity:  normal  
Keywords:           |       Testcase:          
      Os:  MacOS X  |   Architecture:  x86     
--------------------+-------------------------------------------------------
 The following program runs `cat` as an external process, and tries to kill
 it if an exception such as ctrl-c is received.

 {{{
 module Main where

 import System.Process
 import Control.Exception (finally)

 main = do
     pid <- runProcess "cat" [] Nothing Nothing Nothing Nothing Nothing
     waitForProcess pid `finally` do
         putStrLn "killing"
         terminateProcess pid
     print "Done!"
 }}}
 With ghc-6.8.3, the subprocess is killed when ctrl-c is pressed.  However,
 with ghc-6.10.3 the program acts oddly:

 {{{
 $ ./raw
 ^C^C
 $ cat: stdin: Input/output error

 }}}

 The first time that ctrl-c is pressed, it is ignored.  The second time, it
 kills the program (without calling the handler set by `finally`) but the
 cat program is still running.

 I ran into this bug because it makes custom Cabal `Setup.hs` scripts
 unkillable by ctrl-c.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3317>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list