From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29117 invoked by alias); 28 Aug 2013 13:02:10 -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: 17945 Received: (qmail 17078 invoked from network); 28 Aug 2013 13:02:03 -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 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at necoro.eu does not designate permitted sender hosts) Message-ID: <521DF308.4040106@necoro.eu> Date: Wed, 28 Aug 2013 14:54:32 +0200 From: =?ISO-8859-15?Q?Ren=E9_Neumann?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130826 Thunderbird/17.0.8 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Implicit killing of subprocesses Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Hi, I have a question regarding if and when subprocesses are killed when exiting a shell script. My case: I want to pipe the output of a longrunning process (here: dbus-monitor) through some evaluation. As it does not read from stdin, I can't simply close it by sending EOF. When I use coproc dbus-monitor while read -p line; do ... done the dbus-monitor process lurks around after the script finishes (breaking or returning from the loop). When I use dbus-monitor | while read -p line; do ... done it does not (i.e. it gets killed). My questions now are: - Can I build on the process being killed when exiting the loop (in the second case)? Or does it only work in some cases? - Is it intentional that coprocs don't get killed and I have to make it by hand? (Which is hard if you have "coproc dbus-monitor | grep ...", as $! only holds the grep). Thanks and regards, René