summaryrefslogtreecommitdiff
path: root/ghc/InteractiveUI.hs
diff options
context:
space:
mode:
authorBenno Fünfstück <benno.fuenfstueck@gmail.com>2014-01-03 17:17:30 +0100
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>2014-01-03 20:32:08 +0100
commit4d70840db82065bf19767a5f7231a9b1a3f56e38 (patch)
tree277eeeed8a0c45ecda9f3a92eb6810e86817521c /ghc/InteractiveUI.hs
parent9e10d1883d7ea5ea422cda79b426f51d2b59b14d (diff)
downloadhaskell-4d70840db82065bf19767a5f7231a9b1a3f56e38.tar.gz
Fix #5209: Reset GHCi prompt in multiline mode
GHCi didn't reset the multiline prompt when an exception (in particular, the UserInterrupt exception) occured. This commit uses `finally` to reset the prompt in all cases.
Diffstat (limited to 'ghc/InteractiveUI.hs')
-rw-r--r--ghc/InteractiveUI.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index c007a1c37e..537581215c 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -726,8 +726,7 @@ runOneCommand eh gCmd = do
st <- lift getGHCiState
let p = prompt st
lift $ setGHCiState st{ prompt = prompt2 st }
- mb_cmd <- collectCommand q ""
- lift $ getGHCiState >>= \st' -> setGHCiState st'{ prompt = p }
+ mb_cmd <- collectCommand q "" `GHC.gfinally` lift (getGHCiState >>= \st' -> setGHCiState st' { prompt = p })
return mb_cmd
-- we can't use removeSpaces for the sublines here, so
-- multiline commands are somewhat more brittle against