From 87c0d8c15abc3004aa08c429e62f74e25e8d0c64 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 15 Aug 2000 11:56:08 +0000 Subject: [PATCH] [project @ 2000-08-15 11:56:08 by simonmar] fail properly in ghcExit, now that we don't call error any more. --- ghc/compiler/main/ErrUtils.lhs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/main/ErrUtils.lhs b/ghc/compiler/main/ErrUtils.lhs index 7e6e181..db0c997 100644 --- a/ghc/compiler/main/ErrUtils.lhs +++ b/ghc/compiler/main/ErrUtils.lhs @@ -20,6 +20,8 @@ import Bag ( Bag, bagToList, isEmptyBag ) import SrcLoc ( SrcLoc, noSrcLoc ) import Util ( sortLt ) import Outputable + +import System ( ExitCode(..), exitWith ) import IO ( hPutStr, stderr ) \end{code} @@ -83,11 +85,10 @@ pprBagOfWarnings bag_of_warns = pprBagOfErrors bag_of_warns \begin{code} ghcExit :: Int -> IO () - ghcExit val - = if val /= 0 - then hPutStr stderr "\nCompilation had errors\n\n" - else return () + | val == 0 = exitWith ExitSuccess + | otherwise = do hPutStr stderr "\nCompilation had errors\n\n" + exitWith (ExitFailure val) \end{code} \begin{code} -- 1.7.10.4