From cbe2843a506a4fab2aabe7b8e3a3e04f6fa4b44c Mon Sep 17 00:00:00 2001 From: Bertram Felgenhauer Date: Thu, 3 May 2007 21:25:14 +0000 Subject: [PATCH] fix exit code of ghci -e "return ()" This should result in successful program termination. Not doing this breaks checking the exit code of runghc Setup.lhs build for example. --- compiler/ghci/InteractiveUI.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 9b0bdf9..77acf89 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -539,7 +539,7 @@ runStmt stmt step result <- io $ withProgName (progname st) $ withArgs (args st) $ GHC.runStmt session stmt step afterRunStmt result - return False + return (isRunResultOk result) afterRunStmt :: GHC.RunResult -> GHCi (Maybe (Bool,[Name])) @@ -583,6 +583,11 @@ switchOnRunResult (GHC.RunBreak threadId names info) = do return (Just (True,names)) +isRunResultOk :: GHC.RunResult -> Bool +isRunResultOk (GHC.RunOk _) = True +isRunResultOk _ = False + + showTypeOfName :: Session -> Name -> GHCi () showTypeOfName session n = do maybe_tything <- io (GHC.lookupName session n) -- 1.7.10.4