Commit 0e749250 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

GHC: Expose installSignalHandlers, withCleanupSession

Test Plan: Validate

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2492

GHC Trac Issues: #12398
parent 28b71c55
......@@ -13,6 +13,8 @@ module GHC (
defaultErrorHandler,
defaultCleanupHandler,
prettyPrintGhcErrors,
installSignalHandlers,
withCleanupSession,
-- * GHC Monad
Ghc, GhcT, GhcMonad(..), HscEnv,
......@@ -437,6 +439,7 @@ runGhc mb_top_dir ghc = do
ref <- newIORef (panic "empty session")
let session = Session ref
flip unGhc session $ do
liftIO installSignalHandlers -- catch ^C
initGhcMonad mb_top_dir
withCleanupSession ghc
......@@ -456,6 +459,7 @@ runGhcT mb_top_dir ghct = do
ref <- liftIO $ newIORef (panic "empty session")
let session = Session ref
flip unGhcT session $ do
liftIO installSignalHandlers -- catch ^C
initGhcMonad mb_top_dir
withCleanupSession ghct
......@@ -490,8 +494,7 @@ withCleanupSession ghc = ghc `gfinally` cleanup
initGhcMonad :: GhcMonad m => Maybe FilePath -> m ()
initGhcMonad mb_top_dir
= do { env <- liftIO $
do { installSignalHandlers -- catch ^C
; initStaticOpts
do { initStaticOpts
; mySettings <- initSysTools mb_top_dir
; dflags <- initDynFlags (defaultDynFlags mySettings)
; checkBrokenTablesNextToCode dflags
......
......@@ -149,7 +149,10 @@ filepath
ghc
~~~
- TODO FIXME.
- The ``GHC.initGhcMonad`` function no longer installs signal handlers by
default. This means that the RTS won't attempt to handle Ctrl-C gracefully.
If you would like to use GHC's signal handlers, call
``GHC.installSignalHandlers`` during initialization.
ghc-boot
~~~~~~~~
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment