projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02c891a
)
only make stdin/stdout unbuffered in GHCi, not runghc or ghc -e.
author
Simon Marlow
<simonmar@microsoft.com>
Thu, 28 Sep 2006 10:54:03 +0000
(10:54 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Thu, 28 Sep 2006 10:54:03 +0000
(10:54 +0000)
compiler/ghci/InteractiveUI.hs
patch
|
blob
|
history
diff --git
a/compiler/ghci/InteractiveUI.hs
b/compiler/ghci/InteractiveUI.hs
index
02fc10c
..
485e329
100644
(file)
--- a/
compiler/ghci/InteractiveUI.hs
+++ b/
compiler/ghci/InteractiveUI.hs
@@
-84,7
+84,7
@@
import Data.Dynamic
import Numeric
import Data.List
import Data.Int ( Int64 )
import Numeric
import Data.List
import Data.Int ( Int64 )
-import Data.Maybe ( isJust, fromMaybe, catMaybes )
+import Data.Maybe ( isJust, isNothing, fromMaybe, catMaybes )
import System.Cmd
import System.CPUTime
import System.Environment
import System.Cmd
import System.CPUTime
import System.Environment
@@
-274,15
+274,19
@@
interactiveUI session srcs maybe_expr = do
newStablePtr stdout
newStablePtr stderr
newStablePtr stdout
newStablePtr stderr
- hFlush stdout
- hSetBuffering stdout NoBuffering
-
-- Initialise buffering for the *interpreted* I/O system
initInterpBuffering session
-- Initialise buffering for the *interpreted* I/O system
initInterpBuffering session
+ when (isNothing maybe_expr) $ do
+ -- Only for GHCi (not runghc and ghc -e):
+ -- Turn buffering off for the compiled program's stdout/stderr
+ turnOffBuffering
+ -- Turn buffering off for GHCi's stdout
+ hFlush stdout
+ hSetBuffering stdout NoBuffering
-- We don't want the cmd line to buffer any input that might be
-- intended for the program, so unbuffer stdin.
-- We don't want the cmd line to buffer any input that might be
-- intended for the program, so unbuffer stdin.
- hSetBuffering stdin NoBuffering
+ hSetBuffering stdin NoBuffering
-- initial context is just the Prelude
prel_mod <- GHC.findModule session prel_name Nothing
-- initial context is just the Prelude
prel_mod <- GHC.findModule session prel_name Nothing
@@
-649,8
+653,6
@@
initInterpBuffering session
Just hval -> writeIORef flush_interp (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:flush"
Just hval -> writeIORef flush_interp (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:flush"
- turnOffBuffering -- Turn it off right now
-
return ()
return ()