Normally, Control-C sends a sigint to a program, and kills it if it's not caught. The gnureadline library will install handlers for sigint. However, even when disabling those handlers in haskell, I still need to hit Control-C twice to kill a program. What's going on?
import System.Console.Readline
main = do
setCatchSignals False
mainLoop
mainLoop = do
maybeLine <- readline ">"
case maybeLine of
Nothing -> putStrLn ":("
Just line -> do
putStr line
putStr " catch:"
catch <- getCatchSignals
putStrLn $ show $ catch
mainLoop