From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22371 invoked from network); 14 Feb 2005 15:34:12 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 14 Feb 2005 15:34:12 -0000 Received: (qmail 30188 invoked from network); 14 Feb 2005 15:34:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Feb 2005 15:34:05 -0000 Received: (qmail 2983 invoked by alias); 14 Feb 2005 15:33:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20813 Received: (qmail 2974 invoked from network); 14 Feb 2005 15:33:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 14 Feb 2005 15:33:59 -0000 Received: (qmail 29848 invoked from network); 14 Feb 2005 15:33:56 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 14 Feb 2005 15:33:48 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 14 Feb 2005 15:32:20 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 14 Feb 2005 15:34:20 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j1EFXkJu023646 for ; Mon, 14 Feb 2005 15:33:47 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j1EFXkkk023643 for ; Mon, 14 Feb 2005 15:33:46 GMT Message-Id: <200502141533.j1EFXkkk023643@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh hackers list Subject: Re: trap .. EXIT doesn't execute when exit is due to a signal In-reply-to: <1050212212914.ZM28823@candle.brasslantern.com> References: <20050212122658.4ae2739b@buddha> <20050212210429.GF49626@dan.emsphone.com> <1050212212914.ZM28823@candle.brasslantern.com> Date: Mon, 14 Feb 2005 15:33:46 +0000 From: Peter Stephenson X-OriginalArrivalTime: 14 Feb 2005 15:34:20.0586 (UTC) FILETIME=[A70610A0:01C512AA] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Bart Schaefer wrote: > It just occured to me that it may very well be the case that bash is > using the POSIX atexit() handler to execute its exit traps, which I > believe would handle the situation described in 3513 without having > to do any special handling of SIGINT. > > However, I'm not positive that covers all the cases in which zsh runs > the exit trap, and it'd have to be used carefully to be sure the exit > trap wasn't run more than once. No, it's not good enough for traps exiting functions. bash only has an EXIT trap for the whole shell. bash-2.05b$ fn() { trap 'echo exiting' EXIT; echo fn run; } bash-2.05b$ fn fn run bash-2.05b$ exit exit exiting You couldn't use atexit() to fix the problem in zsh. You'd need to return from the interrupt and unwind the call stack to the top, then exit. It is a nuisance that EXIT traps aren't always run, however. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************