Ticket #4942 (new bug)
GHC.ConsoleHandler does not call back application when Close button is pressed
|Reported by:||Amatic||Owned by:|
|Type of failure:||Incorrect result at runtime||Difficulty:|
|Test Case:||Blocked By:|
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.