Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 3,610
    • Issues 3,610
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 200
    • Merge Requests 200
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4942

Closed
Open
Opened Feb 02, 2011 by Amatic@trac-Amatic
  • Report abuse
  • New issue
Report abuse New issue

GHC.ConsoleHandler does not call back application when Close button is pressed

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.

Trac metadata
Trac field Value
Version 6.12.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHC API
Test case
Differential revisions
BlockedBy
Related
Blocking
CC lightwing15@hotmail.com
Operating system
Architecture

Related issues

  • Discussion
  • Designs
Assignee
Assign to
8.0.1
Milestone
8.0.1
Assign milestone
Time tracking
None
Due date
None
7
Labels
bug GHC API incorrect runtime result I/O manager P::low Trac import Windows
Assign labels
  • View project labels
Reference: ghc/ghc#4942