[nhc-bugs] nhc doesn't block buffer correctly

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 28 Nov 2001 12:29:22 +0000


> With this function:
> 
> > main :: IO()
> > main = do hSetBuffering stdout (BlockBuffering (Just 3))
> >           putStr ("abcdefgh" ++ inf)
> > inf = inf
> 
> nhc98 produces no output.

Thanks for the bug report.  Patch below.
Regards,
    Malcolm


Index: src/runtime/Builtin/cHPutStr.c
===================================================================
RCS file: /usr/src/master/nhc/src/runtime/Builtin/cHPutStr.c,v
retrieving revision 1.6
diff -u -r1.6 cHPutStr.c
--- src/runtime/Builtin/cHPutStr.c      2001/06/18 13:29:30     1.6
+++ src/runtime/Builtin/cHPutStr.c      2001/11/28 12:26:10
@@ -225,6 +225,7 @@
     }
     /* *dstptr = '\0'; */
     err = fwrite(buf,sizeof(char),reqsize,f->fp);
+    err = fflush(f->fp);
   }
 }