[project @ 2001-09-14 14:51:06 by simonmar]
authorsimonmar <unknown>
Fri, 14 Sep 2001 14:51:06 +0000 (14:51 +0000)
committersimonmar <unknown>
Fri, 14 Sep 2001 14:51:06 +0000 (14:51 +0000)
oops: hPutStr wasn't flushing a line-buffered handle properly at the
end of a line.

MERGE TO STABLE

ghc/lib/std/PrelIO.hsc

index e289596..ab06b78 100644 (file)
@@ -3,7 +3,7 @@
 #undef DEBUG_DUMP
 
 -- -----------------------------------------------------------------------------
--- $Id: PrelIO.hsc,v 1.11 2001/08/23 10:36:50 sewardj Exp $
+-- $Id: PrelIO.hsc,v 1.12 2001/09/14 14:51:06 simonmar Exp $
 --
 -- (c) The University of Glasgow, 1992-2001
 --
@@ -22,7 +22,6 @@ module PrelIO where
 import PrelBase
 
 import PrelPosix
-import PrelMarshalAlloc
 import PrelMarshalUtils
 import PrelStorable
 import PrelCError
@@ -498,7 +497,12 @@ writeLines hdl Buffer{ bufBuf=raw, bufSize=len } s =
        return ()
    shoveString n (c:cs) = do
        n' <- writeCharIntoBuffer raw n c
-       shoveString n' cs
+       if (c == '\n') 
+          then do 
+               new_buf <- commitBuffer hdl raw len n' True{-needs flush-} False
+               writeBlocks hdl new_buf cs
+          else 
+               shoveString n' cs
   in
   shoveString 0 s