id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4942,GHC.ConsoleHandler does not call back application when Close button is pressed,Amatic,,"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.",bug,new,low,7.6.2,GHC API,6.12.3,,,lightwing15@… fryguybob@…,Windows,x86,Incorrect result at runtime,,,,,
