From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 2FAD3BBAF for ; Thu, 29 May 2008 16:36:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIAALdbPkhQW+UCmmdsb2JhbACSKAEBAQEBCAUIBxEEnQ4 X-IronPort-AV: E=Sophos;i="4.27,561,1204498800"; d="scan'208";a="13216072" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 May 2008 16:36:51 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4TEaaXb019941 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 29 May 2008 16:36:51 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIAALdbPkhQW+UCmmdsb2JhbACSKAEBAQEBCAUIBxEEnQ4 X-IronPort-AV: E=Sophos;i="4.27,561,1204498800"; d="scan'208";a="13216068" Received: from main.gmane.org (HELO ciao.gmane.org) ([80.91.229.2]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 May 2008 16:36:49 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1K1jFC-0005Yd-Oq for caml-list@inria.fr; Thu, 29 May 2008 14:36:42 +0000 Received: from ks300734.kimsufi.com ([91.121.65.225]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 May 2008 14:36:42 +0000 Received: from sylvain by ks300734.kimsufi.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 May 2008 14:36:42 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sylvain Le Gall Subject: Re: Pipes and Standard Output / Input on Windows Date: Thu, 29 May 2008 14:36:28 +0000 (UTC) Message-ID: References: <3C72DA5E-36A7-411B-AFFA-EE26DA74D9B5@coherentgraphics.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ks300734.kimsufi.com User-Agent: slrn/pre0.9.9-102 (Linux) Sender: news X-Miltered: at discorde with ID 483EBF74.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; le-gall:01 ocaml:01 command-line:01 toolchain:01 wrote:01 msvc:01 cleanly:01 bin:01 variant:02 data:02 data:02 compiling:02 binary:02 output:02 output:02 On 29-05-2008, John Whitington wrote: > Hullo. > > I'm compiling OCaml command-line software with the MSVC toolchain on > Windows. Users have noticed two problems: > > (b) Chaining invocations of the tool together using pipes on Windows > often fails. The second process in the chain gets an End_Of_File after > only a few hundred bytes of data. I've confirmed the data is all being > output by the first process, and the first process is exiting cleanly. > All the open_in and open_out calls are using the _bin variant. The > data being sent down the pipe is a PDF file (which contains binary > sections). > > Neither of these problems occur on Linux / Mac builds - is there > something about windows pipes I should know? > Yep, on windows GetStdHandle doesn't always return the same kind of handle depending on the context: - if the output/input is console, it is console handle (i.e. need to be manipulated through console function) - if the output/input is a pipe, it is a pipe handle (i.e. need to be manipulated through pipe function) And since we are in the good old world of windows, the return type is an HANDLE whatever it is ;-) I think your issue is related to this difference. It can be fixed, but you need a little bit of knowledge about windows pipe/standard handle. Regards, Sylvain Le Gall