#4942: GHC.ConsoleHandler does not call back application when Close button is
pressed
------------------------+---------------------------------------------------
Reporter: Amatic | Owner:
Type: bug | Status: new
Priority: normal | Component: GHC API
Version: 6.12.3 | Keywords:
Testcase: | Blockedby:
Os: Windows | Blocking:
Architecture: x86 | Failure: Incorrect result at runtime
------------------------+---------------------------------------------------
The test program below is not called back by GHC.ConsoleHandler when the
Close button is pressed during the threadDelay call. A message is written
to console_event.log as expected when Ctrl-C or Ctrl-Break is pressed, but
not when the Close button is pressed.
{{{
import Control.Concurrent (threadDelay)
import GHC.ConsoleHandler
import System.IO
onConsoleEventReceived :: ConsoleEvent -> IO ()
onConsoleEventReceived event = withFile "console_event.log" AppendMode $ \
file -> do
hPutStrLn file $ case event of
ControlC -> "Received Ctrl-C event"
Break -> "Received Ctrl-Break event"
Close -> "Received X button event"
_ -> "Received other console event"
hFlush file
main :: IO ()
main = installHandler (Catch onConsoleEventReceived) >> threadDelay
(20*1000000)
}}}
The host OS is Windows XP SP3.
Please let me know if you need any more info.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4942>
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