From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 452 invoked by alias); 4 Oct 2014 21:01:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33353 Received: (qmail 21952 invoked from network); 4 Oct 2014 21:01:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <141004140148.ZM7815@torch.brasslantern.com> Date: Sat, 04 Oct 2014 14:01:48 -0700 In-reply-to: <87iojztyzg.fsf@gmail.com> Comments: In reply to Christian Neukirchen "Re: piping question" (Oct 4, 9:29pm) References: <1412259225.3798.0@numa-i> <141003082330.ZM15100__40912.263657856$1412349949$gmane$org@torch.brasslantern.com> <87mw9bu94f.fsf@gmail.com> <141004111755.ZM7181@torch.brasslantern.com> <87iojztyzg.fsf@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: piping question MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 4, 9:29pm, Christian Neukirchen wrote: } Subject: Re: piping question } } Bart Schaefer writes: } } > local procself=/proc/self } > procself=${procself:A} # Resolve symlink to actual PID } > local stdin } > exec {stdin}<&0 } > rxvt -e most "$@" $procself/fd/$stdin } > exec {stdin}<&- } } This works great with less -f, thanks! Beware that whatever is on the left side of the pipe may not see EOF when "less" exits, so you may need to arrange to interrupt it some other way. For who may be interested, the parent zsh is holding open the file descriptor that serves as the read end of the pipe. This happens only if you backgroud the entire pipeline, e.g. cat /dev/zero | xmost & The pipe here stays open in the parent shell until the whole job is done, and trying to close it with <&- gives e.g. file descriptor 11 used by shell, not closed So I think we still have a few bugs along the lines of workers/32171 and 32176 and perhaps 31919.