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. -- Taylor C. Venable http://metasyntax.net/ -- 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
