runInteractiveProcess and buffering
agl at imperialviolet.org
Fri Oct 12 23:52:46 EDT 2007
On 10/12/07, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> The data of 'out' seems to be buffered, because 'aseqdump' must produce
> many lines until even the first one is returned by 'hGetLine' and printed
> by 'putStrLn'. I tried to disable buffering for 'out' and indeed
> 'NoBuffering' is printed to the terminal, but the output from 'aseqdump'
> is still deferred.
[I suspect this is a job for haskell-cafe@, anyway]
Are you sure that you aseqdump isn't buffering itself? The standard C
libraries will buffer output at the line level at least, and are free
to buffer much more than that if they think that the output is not to
Try building this code:
write(1, "line 2\n", 7);
For me (glibc 2.6), if I send stdout to a terminal then it's line
buffered and I get the lines in the correct order. However, if I
redirect to a file, line 3 comes first because the printf lines are
buffered until the process dies.
Adam Langley agl at imperialviolet.org
More information about the Libraries