From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Warp <warplayer@free.fr>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] input_line is blocking
Date: Sun, 5 May 2002 15:09:57 +0200 [thread overview]
Message-ID: <20020505150957.A575@ice.gerd-stolpmann.de> (raw)
In-Reply-To: <001101c1f29c$98e4b570$5000a8c0@warp>; from warplayer@free.fr on Fri, May 03, 2002 at 14:18:13 +0200
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
prev parent reply other threads:[~2002-05-05 13:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-03 12:18 Warp
2002-05-03 14:13 ` Oliver Bandel
2002-05-03 17:26 ` Remi VANICAT
2002-05-05 13:09 ` Gerd Stolpmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020505150957.A575@ice.gerd-stolpmann.de \
--to=info@gerd-stolpmann.de \
--cc=caml-list@inria.fr \
--cc=warplayer@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox