#2301: Proper handling of SIGINT/SIGQUIT
------------------------------------------+---------------------------------
Reporter: duncan | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.0.2
Component: libraries/process | Version: 6.12.3
Resolution: | Keywords:
Testcase: | Blockedby:
Difficulty: Unknown | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: Incorrect result at runtime |
------------------------------------------+---------------------------------
Comment(by mcandre):
Incidentally, this works for me:
{{{
#!/usr/bin/env runhaskell
-- Press Control+C to quit.
--
-- Andrew Pennebaker
-- 7 Feb 2011
--
-- Based on Per Magnus Therning's "Signals in Haskell"
-- http://therning.org/magnus/archives/285
--
-- Based on Rosetta Code
-- http://rosettacode.org/wiki/Handle_a_signal#Haskell
-- Prevents Prelude shadowing other imports
{-# LANGUAGE NoImplicitPrelude #-}
module SigIntTest where
import Prelude hiding (catch)
import Control.Exception (catch, throwIO, AsyncException(UserInterrupt))
import Control.Monad (forever, when)
import System.Posix (sleep)
import System.Exit (exitFailure)
main :: IO ()
main = do
catch (forever $ do
putStrLn "Repeating"
sleep 1)
(\e -> when (e == UserInterrupt)
exitFailure)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2301#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs