fix exit code of ghci -e "return ()"
authorBertram Felgenhauer <int-e@gmx.de>
Thu, 3 May 2007 21:25:14 +0000 (21:25 +0000)
committerBertram Felgenhauer <int-e@gmx.de>
Thu, 3 May 2007 21:25:14 +0000 (21:25 +0000)
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

index 9b0bdf9..77acf89 100644 (file)
@@ -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)