From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4812 invoked from network); 5 Nov 2000 02:00:11 -0000 Received: from sunsite.dk (HELO sunsite.auc.dk) (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Nov 2000 02:00:11 -0000 Received: (qmail 17313 invoked by alias); 5 Nov 2000 02:00:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13117 Received: (qmail 17296 invoked from network); 5 Nov 2000 02:00:04 -0000 From: "Bart Schaefer" Message-Id: <1001105015958.ZM7352@candle.brasslantern.com> Date: Sun, 5 Nov 2000 01:59:58 +0000 In-Reply-To: <1001104232950.ZM3561@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "PATCH: Misc. zpty tweaks, plus commentary" (Nov 4, 11:29pm) References: <1001104232950.ZM3561@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: Re: PATCH: Misc. zpty tweaks, plus commentary MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 4, 11:29pm, I wrote: } } `zpty -w' already was able to stream into the pty (even though that's } not documented); e.g. `zpty -w foo < file' writes the entire contents } of the file to the pty [...] Now `zpty -r foo' can stream the output } as well. Unfortunately, it's still not possible to do both at once. } } The problem is that whenever zsh forks a builtin, it closes all } descriptors numbered higher than 10, which includes the master pty } descriptor. Although a C-code-level fix would be preferable, a workaround has just occurred to me: Using a subshell will prevent the descriptors from being closed. So with 13116 applied, you should be able to do: zpty -b foo cat yes blah | (zpty -w foo) & (zpty -r foo) | less zpty -d foo This reveals that still another remaining problem is that `zpty -w' on a blocking pty doesn't stop when the process on the pty is killed. There doesn't seem to be any simple fix for this; write() itself is blocked, and does not get interrupted with SIGPIPE as would normally occur. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net