Browse thread
[Caml-list] Pipes in 3.01
- Laszlo Nemeth
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Laszlo Nemeth <laszlo@r...> |
| Subject: | [Caml-list] Pipes in 3.01 |
Hi,
I'm trying to implement an api for daVinci (my first ocaml program!)
and pipes don't seem to work:
module DaVinciAPI : DAVINCIAPI =
struct
exception DaVinciInitError
let daVinci () =
begin try
let (dIn, dOut) = Unix.pipe () in
let dProcess = Unix.create_process "daVinci"
[| "-pipe" |]
~stdin:dIn
~stdout:dOut
~stderr:Unix.stderr
and buf = String.create 100 in
let len = Unix.read dIn ~buf ~pos:0 100 in
if len > 0 then () else raise DaVinciInitError
with Unix.Unix_error _ -> raise DaVinciInitError
end;
The application starts up nicely, but I can't communicate with it. The
read blocks. On the other hand, if I start up daVinci in a shell (with
-pipe) it immediately sends back the string ok. I also tried to write
to the pipe, but to no avail (while doing the same from a shell works
perfectly).
Sorry for the probably trivial question but I haven't been able to
find (the new examples) examples of programming with pipes.
Any help, hints, pointers are appreciated.
Thanks, Laszlo
PS. I'm using the interactive environment (after linking in the unix
library) under Solaris.
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr