[commit: ghc] master: Fix #5209: Reset GHCi prompt in multiline mode (4d70840)

git at git.haskell.org git at git.haskell.org
Fri Jan 3 21:25:01 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4d70840db82065bf19767a5f7231a9b1a3f56e38/ghc

>---------------------------------------------------------------

commit 4d70840db82065bf19767a5f7231a9b1a3f56e38
Author: Benno Fünfstück <benno.fuenfstueck at gmail.com>
Date:   Fri Jan 3 17:17:30 2014 +0100

    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.


>---------------------------------------------------------------

4d70840db82065bf19767a5f7231a9b1a3f56e38
 ghc/InteractiveUI.hs |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index c007a1c..5375812 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



More information about the ghc-commits mailing list