Repository : ssh://darcs.haskell.org//srv/darcs/packages/base On branch : master
http://hackage.haskell.org/trac/ghc/changeset/2a8af853d63dd00a3a3690db44e767a08e0f0a66 >--------------------------------------------------------------- commit 2a8af853d63dd00a3a3690db44e767a08e0f0a66 Author: Simon Marlow <[email protected]> Date: Mon Nov 7 15:24:35 2011 +0000 export flushAllHandles (#5594) >--------------------------------------------------------------- GHC/TopHandler.lhs | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/GHC/TopHandler.lhs b/GHC/TopHandler.lhs index 0ebc42c..419edff 100644 --- a/GHC/TopHandler.lhs +++ b/GHC/TopHandler.lhs @@ -30,6 +30,7 @@ module GHC.TopHandler ( runMainIO, runIO, runIOFastExit, runNonIO, topHandler, topHandlerFastExit, reportStackOverflow, reportError, + flushStdHandles ) where #include "HsBaseConfig.h" @@ -68,9 +69,7 @@ runMainIO main = case m of Nothing -> return () Just tid -> throwTo tid (toException UserInterrupt) - a <- main - cleanUp - return a + main -- hs_exit() will flush `catch` topHandler @@ -157,8 +156,8 @@ topHandlerFastExit err = -- another error, etc.) -- real_handler :: (Int -> IO a) -> SomeException -> IO a -real_handler exit se@(SomeException exn) = - cleanUp >> +real_handler exit se@(SomeException exn) = do + flushStdHandles -- before any error output case cast exn of Just StackOverflow -> do reportStackOverflow @@ -184,8 +183,8 @@ real_handler exit se@(SomeException exn) = -- try to flush stdout/stderr, but don't worry if we fail -- (these handles might have errors, and we don't want to go into -- an infinite loop). -cleanUp :: IO () -cleanUp = do +flushStdHandles :: IO () +flushStdHandles = do hFlush stdout `catchAny` \_ -> return () hFlush stderr `catchAny` \_ -> return () _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
