summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ghc/InteractiveUI.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 552b61cdc3..80ec79dd21 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -404,8 +404,10 @@ runGHCi paths maybe_exprs = do
-- NOTE: this assumes that runInputT won't affect the terminal;
-- can we assume this will always be the case?
-- This would be a good place for runFileInputT.
- Right hdl -> runInputTWithPrefs defaultPrefs defaultSettings $ do
+ Right hdl ->
+ do runInputTWithPrefs defaultPrefs defaultSettings $
runCommands $ fileLoop hdl
+ liftIO (hClose hdl `IO.catch` \_ -> return ())
where
getDirectory f = case takeDirectory f of "" -> "."; d -> d