From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10071 invoked from network); 22 Dec 1999 10:48:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Dec 1999 10:48:07 -0000 Received: (qmail 14639 invoked by alias); 22 Dec 1999 10:48:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9133 Received: (qmail 14629 invoked from network); 22 Dec 1999 10:47:48 -0000 Subject: Re: More tests In-Reply-To: from Peter Stephenson at "Dec 21, 1999 10:35:40 pm" To: Peter Stephenson Date: Wed, 22 Dec 1999 10:47:31 +0000 (GMT) CC: Zsh hackers list X-Mailer: ELM [version 2.4ME+ PL65 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: From: Zefram Peter Stephenson wrote: >2. There's something wrong with synchronisation in multios: >% print hello >foo >bar && print "$( What happens here is that stdout for the first print is a pipe to a process doing what amounts to a tee. After the print, that pipe gets closed, the tee process notices this and exits, after it's written all the pending data to its outputs. However, this is fundamentally done asynchronously. Closing the tee's input does not immediately force the tee to complete. Quite feasibly, the print could send its output and close tee's input and then the empty foo gets read, all in a single timeslice, before tee has had a chance to look at its input. To fix this, closing the redirected fd would have to also wait for the tee process to exit. This should be doable by storing pids in the save array and waiting in fixfds(). There's also the subtlety of nested tees to handle. Might be easier just to save all the necessary pids in a single linked list, separately from the saved fd information; we don't really need to correlate them. There's a similar issue with input multios. The closing of the multio fd should guarantee that all the input files have been closed. This could be done most easily by directly killing the cat process (at this point, we *want* to lose any data it has buffered). -zefram