Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

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.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
Bug reports:  FAQ:
To unsubscribe, mail  Archives: