summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-08-30 17:05:43 -0400
committerBen Gamari <ben@smart-cactus.org>2016-08-31 13:15:33 -0400
commit0e7492508cefbcabb4cf1398cfb3669edb72db77 (patch)
tree033737497023e3d39cca2792a2d1fb7290f41d6f
parent28b71c55d057b780d92b351498ec611287dedbd4 (diff)
downloadhaskell-0e7492508cefbcabb4cf1398cfb3669edb72db77.tar.gz
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
-rw-r--r--compiler/main/GHC.hs7
-rw-r--r--docs/users_guide/8.2.1-notes.rst5
2 files changed, 9 insertions, 3 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 9dc68537d9..6a3887a0e9 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -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
diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst
index c50990f1b2..bb31d95cbf 100644
--- a/docs/users_guide/8.2.1-notes.rst
+++ b/docs/users_guide/8.2.1-notes.rst
@@ -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
~~~~~~~~