Version française
Home     About     Download     Resources     Contact us    
Browse thread
commands.getoutput () in ocaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] commands.getoutput () in ocaml?
On Wed, Aug 22, 2007 at 11:03:42PM -0500, Dave Benjamin wrote:
> However, this doesn't work unless I set buffer_size to 1. Otherwise, the 
> End_of_file fires before all the data is read in, so I either get nothing 
> or an incomplete result.

Since you can't use Pervasives.in_channel_length on a pipe, the only
way I see is to write a special add_channel_tail function, called only
when you catch the first Eof, that tries successively to add_channel
n, n-1, n-2, ... etc. bytes until it succeeds. Sigh.

-- 
Eric Cooper             e c c @ c m u . e d u