projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
e47c481
)
Restore the terminal attributes even if ghci does not exit normally.
author
Judah Jacobson
<judah.jacobson@gmail.com>
Mon, 20 Oct 2008 16:41:09 +0000
(16:41 +0000)
committer
Judah Jacobson
<judah.jacobson@gmail.com>
Mon, 20 Oct 2008 16:41:09 +0000
(16:41 +0000)
compiler/ghci/InteractiveUI.hs
patch
|
blob
|
history
diff --git
a/compiler/ghci/InteractiveUI.hs
b/compiler/ghci/InteractiveUI.hs
index
e385f6b
..
268f05e
100644
(file)
--- a/
compiler/ghci/InteractiveUI.hs
+++ b/
compiler/ghci/InteractiveUI.hs
@@
-393,10
+393,9
@@
withTerminalReset f = do
isTTY <- liftIO $ hIsTerminalDevice stdout
if not isTTY
then f
- else do
- oldAttrs <- liftIO $ getTerminalAttributes stdOutput
- f
- liftIO $ setTerminalAttributes stdOutput oldAttrs Immediately
+ else gbracket (liftIO $ getTerminalAttributes stdOutput)
+ (\attrs -> liftIO $ setTerminalAttributes stdOutput attrs Immediately)
+ (const f)
#endif
runGHCi :: [(FilePath, Maybe Phase)] -> Maybe [String] -> GHCi ()