summaryrefslogtreecommitdiff
path: root/ghc/lib/std/IO.lhs
diff options
context:
space:
mode:
authorsof <unknown>1999-01-15 17:54:23 +0000
committersof <unknown>1999-01-15 17:54:23 +0000
commitb9bd8aedf924bd9396c2634792f5c472b36c3bf0 (patch)
tree51803079c75b0a650fb2a754bd5833202c86bbd6 /ghc/lib/std/IO.lhs
parentfc3a5e13e8980632ca5b9ae589fab11818b4d425 (diff)
downloadhaskell-b9bd8aedf924bd9396c2634792f5c472b36c3bf0.tar.gz
[project @ 1999-01-15 17:54:20 by sof]
Re-integrated mod. that seems to have been dropped on the floor when new-rts moved back onto the main trunk. Here's the commit msg. that was originally used: Extend hConnectTo to also allow output handles to be connected, i.e., h1 <- openFile "foo" WriteMode h2 <- openFile "bar" WriteMode hConnectTo h1 h2 will cause h1's buffer to be flushed when h2's buffer overflows (and it is just about to be flushed.) The implementation is currently not as lazy as that, it flushes h1's buffer regardless of whether a write to h2 causes h2's buffer to overflow or not. This is used to connect 'stderr' and 'stdout', i.e., output on 'stderr' will now cause 'stdout' output to (first) be flushed.
Diffstat (limited to 'ghc/lib/std/IO.lhs')
-rw-r--r--ghc/lib/std/IO.lhs2
1 files changed, 2 insertions, 0 deletions
diff --git a/ghc/lib/std/IO.lhs b/ghc/lib/std/IO.lhs
index 1b458cbefe..6670ff3172 100644
--- a/ghc/lib/std/IO.lhs
+++ b/ghc/lib/std/IO.lhs
@@ -358,6 +358,7 @@ hPutChar :: Handle -> Char -> IO ()
hPutChar handle c =
wantWriteableHandle "hPutChar" handle $ \ handle_ -> do
let fo = haFO__ handle_
+ flushConnectedBuf fo
rc <- mayBlock fo (CCALL(filePutc) fo c) -- ConcHask: UNSAFE, may block.
writeHandle handle handle_
if rc == 0
@@ -374,6 +375,7 @@ hPutStr :: Handle -> String -> IO ()
hPutStr handle str =
wantWriteableHandle "hPutStr" handle $ \ handle_ -> do
let fo = haFO__ handle_
+ flushConnectedBuf fo
case haBufferMode__ handle_ of
LineBuffering -> do
buf <- CCALL(getWriteableBuf) fo