summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
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 /compiler/main/GHC.hs
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
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r--compiler/main/GHC.hs7
1 files changed, 5 insertions, 2 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