#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:  MacOS X
  Blocking:                               |   Architecture:  x86    
   Failure:  Incorrect result at runtime  |  
------------------------------------------+---------------------------------
Changes (by mcandre):

  * failure:  None/Unknown => Incorrect result at runtime
  * version:  6.8.2 => 6.12.3
  * os:  Unknown/Multiple => MacOS X
  * architecture:  Unknown/Multiple => x86


Comment:

 I can pass control to a handler for SIGINT, but exitFailure does nothing
 to end my program.

 Code:

 {{{
 #!/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

 module SigIntTest where

 import System.Posix.Signals
 import Control.Monad (forever)
 import System.Posix (sleep)
 import System.Exit (exitFailure)

 main :: IO ()
 main = do
         mapM (\sig -> installHandler sig (Catch $ exitFailure) Nothing)
 [sigINT, sigHUP, sigABRT, sigTERM]

         forever $ do
                 putStrLn "Repeating"
                 sleep 1
 }}}

 Trace:

 {{{
 $ ./siginttest.hs
 Repeating
 Repeating
 Repeating
 ^Csiginttest.hs: ExitFailure 1
 Repeating
 Repeating
 ^Csiginttest.hs: ExitFailure 1
 Repeating
 Repeating
 Repeating
 ...
 }}}

 Specs:

 GHC 6.12.3

 Mac OS X 10.6.6

 !MacBook Pro 5,1

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2301#comment:19>
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

Reply via email to