From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11445 invoked from network); 1 Jun 2005 14:24:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Jun 2005 14:24:35 -0000 Received: (qmail 15341 invoked from network); 1 Jun 2005 14:24:21 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Jun 2005 14:24:21 -0000 Received: (qmail 15306 invoked by alias); 1 Jun 2005 14:23:56 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8927 Received: (qmail 15145 invoked from network); 1 Jun 2005 14:23:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Jun 2005 14:23:54 -0000 Received: (qmail 10430 invoked from network); 1 Jun 2005 14:23:54 -0000 Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by a.mx.sunsite.dk with SMTP; 1 Jun 2005 14:23:46 -0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DdU38-0008Vk-QS for zsh-users@sunsite.dk; Wed, 01 Jun 2005 16:18:26 +0200 Received: from h34-aclarke.sv.meer.net ([205.217.153.34]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2005 16:18:26 +0200 Received: from tk-gmane+at by h34-aclarke.sv.meer.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2005 16:18:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@sunsite.dk From: "Tim K. (Gmane)" Subject: named pipes blocking zsh Date: Wed, 01 Jun 2005 07:18:38 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: h34-aclarke.sv.meer.net User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en Sender: news X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hello, I have a situtation with zsh: I use pine as my mail reader and it has a feature where it can create a named pipe (FIFO) and write to it when new mail arrives. Naturally, I thought of writing a script at the other end of the pipe that reads the messages and sends me notifications in some other way. The way I have it set up is to have a zsh script that starts another "notify" child zsh script that reads from the pipe and does its notification thing and then the main script calls pine. This all seems to work, except when I quit pine, hence terminating the main "parent" script, the child "notify" script does not exit, it's stuck reading from the pipe (even though the pipe is deleted). The child script becomes owned by PPID 1 and the only way to kill it is kill -9 ... I'm reading with the built in "read var < pine_pipe" which blocks until the first line of data is written to the pipe by pine. I also tried "read -t" but it doesn't react to the timeout. Also tried the zselect module, with and without timeouts, nothing works. If there's nothing in the pipe, the zsh process just hangs until there is data. My current workaround is to trap the exits from the main script and kill -9 the child script. This works fine almost all the time except when the main script itself is killed and it doesn't have a chance to kill it's child. For this I made the notify script clean up any running instances of itself when it comes up (but there's still that window of time where there's a zsh process around that refuses to die). Is there anything in particular I should be aware of with these named pipes? I'm using zsh 4.2.1 if it makes a difference ... Thanks for your help. -- Tim