On 10/01/2011 04:55 AM, Taylor Venable wrote:
> On Fri, Sep 30, 2011 at 05:45, Jerome Vouillon <[email protected]> 
> wrote:
>> 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.
> 
> Nope, I'm not forking. I also tried putting an explicit exit at the
> end of my program, but I already close_out my file before then so it
> doesn't make a difference. Thanks for the ideas, though.
> 

Do you use threads?

--Edwin

-- 
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