From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17440 invoked by alias); 15 Mar 2011 19:05:08 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15872 Received: (qmail 4751 invoked from network); 15 Mar 2011 19:04:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.218.43 as permitted sender) Date: Tue, 15 Mar 2011 14:04:49 -0500 (CDT) From: Rory Mulvaney To: zsh-users@zsh.org Subject: coproc problem when input closed but output open Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Thanks for the tip involving calling coproc exit at the begnning of a coproc shell function, I think using coproc that way is really useful. Now I'm having trouble with another example, where the coproc doesn't return without killing it. Maybe the problem has something to do with the output file descriptor of the coproc still being open. But shouldn't the coproc finish writing its output and exit? Thanks, Rory M. function wcFunc() { coproc exit wc } coproc wcFunc wcf=$! # copy the write and read fd's for the coproc exec 5>&p 6<&p # start another null coproc to get a new target for the p fd coproc exit # copy output of coproc to stdout cat <&6 & exec 6<&- echo hi there >&5 # close the fd, so hopefully the coproc would exit, but it doesn't exec 5>&-