[
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: | David Fox <david@l...> |
| Subject: | [Caml-list] process conundrum |
Suppose I open a process to reverse the lines of a file like so: # let readable, writable = Unix.open_process "cat -n | sort -n -r | sed 's:^[ 0-9]*[^ 0-9]::'";; Then I write a few lines to it: # output_string writable "a\n";; # output_string writable "b\n";; # output_string writable "c\n";; Now I close the write end to cause an EOF, so the output arrives on readable: # close_out writable;; # input_line readable;; - : string = "c" # input_line readable;; - : string = "b" # input_line readable;; - : string = "a" # input_line readable;; Exception: End_of_file. How do I cleanly terminate the process? # Unix.close_process (readable, writable);; Exception: Sys_error "Bad file descriptor". # ------------------- 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