Hello,

On Thu, Sep 29, 2011 at 08:00:47PM -0400, Taylor Venable wrote:
> My trouble is this: if I fail to call flush on the output channels in
> step #4, I get mangled output. By mangled I mean that in the middle of
> one line, suddenly the data from another line appears. The other line
> exists elsewhere in the output. Sometimes lines are simply duplicated.

Are you using Unix.fork? When you fork, the buffers are duplicated and
can thus end up being flushed several times. In particular, the 'exit'
function from the Pervasives module flushes all open output channels.
I don't have a good workaround. You can call 'flush_all' before
forking, but any write error is silently ignored by this function.
Or use 'Unix.execv "/bin/true" [||]' rather than 'exit' to terminate
subprocesses.

-- Jerome

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to