From d6afbe3ebd127ece764bc943c015e74290318b6a Mon Sep 17 00:00:00 2001 From: sof Date: Sat, 3 Nov 2001 01:30:42 +0000 Subject: [PATCH] [project @ 2001-11-03 01:30:42 by sof] main: in both exception handlers, explicitly flush stdout before emitting bytes onto stderr, since the two aren't connected any longer. --- ghc/compiler/main/Main.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index dfe059b..fb1556c 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,7 +1,7 @@ {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.90 2001/10/26 00:53:27 sof Exp $ +-- $Id: Main.hs,v 1.91 2001/11/03 01:30:42 sof Exp $ -- -- GHC Driver program -- @@ -113,6 +113,7 @@ import Dynamic ( toDyn ) main = -- top-level exception handler: any unrecognised exception is a compiler bug. handle (\exception -> do + hFlush stdout case exception of -- an IO exception probably isn't our fault, so don't panic IOException _ -> hPutStr stderr (show exception) @@ -121,11 +122,13 @@ main = ) $ do -- all error messages are propagated as exceptions - handleDyn (\dyn -> case dyn of - PhaseFailed _phase code -> exitWith code - Interrupted -> exitWith (ExitFailure 1) - _ -> do hPutStrLn stderr (show (dyn :: GhcException)) - exitWith (ExitFailure 1) + handleDyn (\dyn -> do + hFlush stdout + case dyn of + PhaseFailed _phase code -> exitWith code + Interrupted -> exitWith (ExitFailure 1) + _ -> do hPutStrLn stderr (show (dyn :: GhcException)) + exitWith (ExitFailure 1) ) $ do -- make sure we clean up after ourselves -- 1.7.10.4