Ctrl-C is not received during a call to runProcess
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |