diff options
author | Patrick Palka <patrick@parcs.ath.cx> | 2013-08-26 17:14:50 -0400 |
---|---|---|
committer | Patrick Palka <patrick@parcs.ath.cx> | 2013-08-26 22:21:17 -0400 |
commit | 7f33152529df7bcdc73f8c67a446f984e6cef325 (patch) | |
tree | cec5a255a00a241f4e8934035428549de632fd1d | |
parent | 997a8ecdae2e3a11697ee57ee48c286714a79fac (diff) | |
download | haskell-7f33152529df7bcdc73f8c67a446f984e6cef325.tar.gz |
Buffer stdout and stderr when we're compiling via GHCi
-rw-r--r-- | ghc/InteractiveUI.hs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 80032f2949..7b7e0a67d1 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -1315,9 +1315,18 @@ doLoad retain_context howmuch = do -- turn off breakpoints before we load: we can't turn them off later, because -- the ModBreaks will have gone away. lift discardActiveBreakPoints - ok <- trySuccess $ GHC.load howmuch - afterLoad ok retain_context - return ok + + -- Enable buffering stdout and stderr as we're compiling. Keeping these + -- handles unbuffered will just slow the compilation down, especially when + -- compiling in parallel. + gbracket (liftIO $ do hSetBuffering stdout LineBuffering + hSetBuffering stderr LineBuffering) + (\_ -> + liftIO $ do hSetBuffering stdout NoBuffering + hSetBuffering stderr NoBuffering) $ \_ -> do + ok <- trySuccess $ GHC.load howmuch + afterLoad ok retain_context + return ok afterLoad :: SuccessFlag |