[commit: ghc] ghc-8.0: GHC: Expose installSignalHandlers, withCleanupSession (aedb412)

git at git.haskell.org git at git.haskell.org
Thu Sep 1 14:02:14 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/aedb41292d042963ad281641f85c26e5c9ea4d4d/ghc

>---------------------------------------------------------------

commit aedb41292d042963ad281641f85c26e5c9ea4d4d
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
    
    (cherry picked from commit 0e7492508cefbcabb4cf1398cfb3669edb72db77)


>---------------------------------------------------------------

aedb41292d042963ad281641f85c26e5c9ea4d4d
 compiler/main/GHC.hs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index ee13976..0a7f6f0 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,
@@ -438,6 +440,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
 
@@ -462,6 +465,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
 
@@ -496,8 +500,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



More information about the ghc-commits mailing list