From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA10336; Wed, 13 Feb 2002 23:26:43 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA10083 for caml-list@pauillac.inria.fr; Wed, 13 Feb 2002 23:26:43 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA09035 for ; Wed, 13 Feb 2002 22:43:21 +0100 (MET) Received: from dsf (adsl-63-196-84-93.dsl.sndg02.pacbell.net [63.196.84.93]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g1DLhFX11378 for ; Wed, 13 Feb 2002 22:43:20 +0100 (MET) Received: from dsf by dsf with local (Exim 3.32 #1 (Debian)) id 16b7BK-0002tp-00 for ; Wed, 13 Feb 2002 13:43:14 -0800 To: caml-list@inria.fr Subject: [Caml-list] process conundrum From: David Fox Date: 13 Feb 2002 13:43:14 -0800 Message-ID: <87adudcb2l.fsf@foxthompson.net> User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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