From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8U9jYA2013893 for ; Fri, 30 Sep 2011 11:45:34 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArwAADmPhU6GnQCBkWdsb2JhbABBqCkiAQEBAQcNCwcUAyKBUwEBBTo/EAsYLhRJv0qDGYMmYQSlGw X-IronPort-AV: E=Sophos;i="4.68,466,1312149600"; d="scan'208";a="122263724" Received: from shiva.jussieu.fr ([134.157.0.129]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Sep 2011 11:45:29 +0200 Received: from hydrogene.pps.jussieu.fr (hydrogene.pps.jussieu.fr [134.157.168.1]) by shiva.jussieu.fr (8.14.4/jtpda-5.4) with ESMTP id p8U9j2t2065116 ; Fri, 30 Sep 2011 11:45:16 +0200 (CEST) X-Ids: 165 Received: from strontium.pps.jussieu.fr (strontium.pps.jussieu.fr [134.157.168.38]) by hydrogene.pps.jussieu.fr (Postfix) with ESMTPS id A979AC0A22; Fri, 30 Sep 2011 11:45:01 +0200 (CEST) Received: from vouillon by strontium.pps.jussieu.fr with local (Exim 4.76) (envelope-from ) id 1R9ZeP-0006H5-Di; Fri, 30 Sep 2011 11:45:01 +0200 Date: Fri, 30 Sep 2011 11:45:01 +0200 From: Jerome Vouillon To: Taylor Venable Cc: caml-list Message-ID: <20110930094501.GA24085@pps.jussieu.fr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Miltered: at jchkmail.jussieu.fr with ID 4E858F9E.018 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 4E858F9E.018/134.157.168.1/hydrogene.pps.jussieu.fr/hydrogene.pps.jussieu.fr/ Subject: Re: [Caml-list] Problem with un-flushed output getting mangled 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