caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jerome Vouillon <vouillon@pps.jussieu.fr>
To: Taylor Venable <taylor@metasyntax.net>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Problem with un-flushed output getting mangled
Date: Fri, 30 Sep 2011 11:45:01 +0200	[thread overview]
Message-ID: <20110930094501.GA24085@pps.jussieu.fr> (raw)
In-Reply-To: <CAAmKFxeFBaqpbW8-rt3GOwvhNKaf2MjZdP20ZydpptksQcTVZA@mail.gmail.com>

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

  reply	other threads:[~2011-09-30  9:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30  0:00 Taylor Venable
2011-09-30  9:45 ` Jerome Vouillon [this message]
2011-10-01  1:55   ` Taylor Venable
2011-10-01  7:11     ` Török Edwin
2011-10-03 10:51       ` Taylor Venable
2011-10-02 11:41 ` Tiphaine Turpin
     [not found] ` <CAGyUfm24stnWFHwWGt4p0gZWA72FM97aXUZTe7wo1i9WDj7nFA@mail.gmail.com>
2011-10-03 19:00   ` Pierre Chopin
2011-10-04  1:39     ` Taylor Venable

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110930094501.GA24085@pps.jussieu.fr \
    --to=vouillon@pps.jussieu.fr \
    --cc=caml-list@inria.fr \
    --cc=taylor@metasyntax.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).