From: "Kim Nguyễn" <Kim.Nguyen@lri.fr>
To: paul.lachat@edu.univ-fcomte.fr
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] [Question] Loading .ml in memory to interact with them.
Date: Fri, 24 Mar 2017 10:04:11 +0100 [thread overview]
Message-ID: <CAJCP7wE840eWMUnE_uSWHWiuxp8Gc-nsXewwBMnEohwYeCdcWw@mail.gmail.com> (raw)
In-Reply-To: <1590236478.9253508.1490261850094.JavaMail.zimbra@edu.univ-fcomte.fr>
On Thu, Mar 23, 2017 at 10:37 AM, <paul.lachat@edu.univ-fcomte.fr> wrote:
> Hello,
>
>
> But when I send the first instruction (ex : #use "file.ml";;\n), the ocaml
> process send back the response and stop.
>
The problem here is that echo (or printf) closes the pipe_in fifo,
hence sending EOF to the ocaml toplevel. You need to force the fifo to
somehow remain open.
tail -f /tmp/pipe_in | ocaml > /tmp/pipe_out
in another terminal, echo to /tmp/pipe_in, and tail -f /tmp/pipe_out
to see the result.
Or a small ocaml program that open_out /tmp/pipe_in and copies its
standard input without closing /tmp/pipe_in (but flushing it
explicitely to be sure each line is sent as soon as possible) :
let () =
let oc = open_out "/tmp/pipe_in" in
while true do
let s = read_line () in
output_string oc s;
output_char oc '\n';
flush oc
done
(catch exceptions where appropriate !).
Hope this helps,
--
Kim
next prev parent reply other threads:[~2017-03-24 9:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 9:37 paul.lachat
2017-03-23 13:02 ` Sébastien Hinderer
2017-03-23 13:26 ` paul.lachat
2017-03-23 13:41 ` Sébastien Hinderer
2017-03-23 13:57 ` paul.lachat
2017-03-23 14:24 ` Evgeny Roubinchtein
2017-03-23 15:09 ` François Bobot
[not found] ` <CAGYXaSbcqNWcXe1MLm_YyS28N7ji3td=L_jFVv35=50oSxaUDQ@mail.gmail.com>
2017-03-23 15:50 ` François Bobot
2017-03-24 9:04 ` Kim Nguyễn [this message]
2017-03-24 14:43 Oleg
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=CAJCP7wE840eWMUnE_uSWHWiuxp8Gc-nsXewwBMnEohwYeCdcWw@mail.gmail.com \
--to=kim.nguyen@lri.fr \
--cc=caml-list@inria.fr \
--cc=paul.lachat@edu.univ-fcomte.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