Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Unix.create_process
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Rolf Wester <wester@i...>
Subject: [Caml-list] Unix.create_process
Hi,

I want to start a process and read the stdout channel of this process.
I tried:

let instring = String.create 10 in
    let pid = Unix.create_process ~prog:"ls" ~args:[|"/usr"|] 
			~stdin:Unix.stdin ~stdout:Unix.stdin ~stderr:Unix.stderr in
    let nread = Unix.read Unix.stdin ~buf:instring ~pos:0 ~len:10 in instring;;

but this one waits for keyboeard input instead of reading the output of ls.
When I type  ~stdout:Unix.stdout instead of  ~stdout:Unix.stdin the ls 
output is written to stdout (as expected).

Can anybody tell me what I made wrong?

Thanks in advance.

Rofl Wester 

-------------------------------------
Rolf Wester
rolf.wester@ilt.fraunhofer.de
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr