summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-12-05 20:53:01 +0000
committerIan Lynagh <igloo@earth.li>2010-12-05 20:53:01 +0000
commit3d290c13b56c9b30cf3ef66bd5744415f4dac086 (patch)
tree6988afbebf7f68a4e0f7c037111db2e0eacada26 /ghc
parent3f82c82ad95fa95cf0ce3a787c934bcccd2c23c4 (diff)
downloadhaskell-3d290c13b56c9b30cf3ef66bd5744415f4dac086.tar.gz
Close .ghci files after reading them; fixes trac #4487
Diffstat (limited to 'ghc')
-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