English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Pipes and Standard Output / Input on Windows
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-06-02 (07:36)
From: John Whitington <john@c...>
Subject: Re: [Caml-list] Re: Pipes and Standard Output / Input on Windows

On 1 Jun 2008, at 22:06, Sylvain Le Gall wrote:

> On 29-05-2008, John Whitington <john@coherentgraphics.co.uk> wrote:
>> I'm compiling OCaml command-line software with the MSVC toolchain on
>> Windows. Users have noticed two problems:
>> (a) When output (such as the --help) is done on Windows, the help
>> doesn't all show (I fixed this by flushing stdout manually - but
>> shouldn't stdout be flushed when the process exits anyway?)

Still no clue on this one, I'm afraid.

>> (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?
> I am not sure if it is related, but i have a problem with "|" command
> line pipe. It seems that this way channel are not binary one... If you
> happen to transmit binary data through it, you could have problem...
> I detect it, by trying "output_value stdin x".
> Do you think your problem is related?

It seems this is correct. See the section "Problems with Pipes" here:


So I'll need to encode the data somehow, or introduce my own chaining
separator on the command line.

John Whitington
Coherent Graphics Ltd