From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA00676; Sun, 5 May 2002 15:10:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA00623 for ; Sun, 5 May 2002 15:10:02 +0200 (MET DST) Received: from moutng0.schlund.de (moutng0.kundenserver.de [212.227.126.170]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g45DA1X09719 for ; Sun, 5 May 2002 15:10:01 +0200 (MET DST) Received: from [212.227.126.160] (helo=mrelayng0.kundenserver.de) by moutng0.schlund.de with esmtp (Exim 3.22 #2) id 174Lm4-0003TT-00; Sun, 05 May 2002 15:10:00 +0200 Received: from [80.129.97.187] (helo=gate.gerd-stolpmann.de) by mrelayng0.kundenserver.de with asmtp (Exim 3.22 #2) id 174Lm4-0002Wl-00; Sun, 05 May 2002 15:10:00 +0200 Received: from ice.gerd-stolpmann.de (ice.gerd-stolpmann.de [192.168.0.13]) by gate.gerd-stolpmann.de (Postfix) with ESMTP id 2C228CCCF; Sun, 5 May 2002 15:09:59 +0200 (CEST) Received: from ice (localhost [127.0.0.1]) by ice.gerd-stolpmann.de (Postfix) with ESMTP id 5F1311AD70; Sun, 5 May 2002 15:09:58 +0200 (MEST) Date: Sun, 5 May 2002 15:09:57 +0200 From: Gerd Stolpmann To: Warp Cc: OCaml Subject: Re: [Caml-list] input_line is blocking Message-ID: <20020505150957.A575@ice.gerd-stolpmann.de> References: <001101c1f29c$98e4b570$5000a8c0@warp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit In-Reply-To: <001101c1f29c$98e4b570$5000a8c0@warp>; from warplayer@free.fr on Fri, May 03, 2002 at 14:18:13 +0200 X-Mailer: Balsa 1.2.4 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 2002.05.03 14:18 Warp wrote: > Hi > I'm running "ocamlc" by using Unix.open_process_full in order to write an > automatic compiler. > Right now, it's working fine, but I got now a problem with input_line : > > after running open_process_full , i'm first reading all its stdout lines of > the process until End_of_file is raised, then all its stderr lines using the > same function. > > It has work fine for few weeks now, but now I found that in some cases > input_line will block, not raising End_of_file. I wrote a library exactly for such advanced usage of sub processes: http://www.ocaml-programming.de/packages/documentation/shell/ For example, to call ocamlc one would do: open Shell let stdout = Buffer.create 16 in let stderr = Buffer.create 16 in call ~stdout:(to_buffer stdout) ~stderr:(to_buffer stderr) [ cmd "ocamlc" args ] The Shell library includes the necessary logic to read from multiple file descriptors (using Unix.select). One drawback: Shell works only for Unix (because of Unix.fork). I think that you have to use multi-threading for a platform-independent solution. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 45 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ---------------------------------------------------------------------------- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners