[commit: ghc] master: GHC: Expose installSignalHandlers, withCleanupSession (0e74925)
git at git.haskell.org
git at git.haskell.org
Wed Aug 31 17:19:29 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0e7492508cefbcabb4cf1398cfb3669edb72db77/ghc
>---------------------------------------------------------------
commit 0e7492508cefbcabb4cf1398cfb3669edb72db77
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Tue Aug 30 17:05:43 2016 -0400
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
>---------------------------------------------------------------
0e7492508cefbcabb4cf1398cfb3669edb72db77
compiler/main/GHC.hs | 7 +++++--
docs/users_guide/8.2.1-notes.rst | 5 ++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 9dc6853..6a3887a 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 c50990f..bb31d95 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
~~~~~~~~
More information about the ghc-commits
mailing list