From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <pws@csr.com>,
zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: test for trap EXIT fix.
Date: Mon, 1 Oct 2001 16:01:58 +0000 [thread overview]
Message-ID: <1011001160158.ZM23006@candle.brasslantern.com> (raw)
In-Reply-To: <16272.1001937697@csr.com>
On Oct 1, 1:01pm, Peter Stephenson wrote:
}
} The comment notes the following behaviour:
}
} fn() {
} ( trap 'print This is in the top-level function scope.' EXIT
} exit
} )
} }
Wait ... why is that trap at the top-level function scope? It's inside a
subshell. Shouldn't the subshell be its own scope?
Anyway, that behavior is not consistent with previous versions of zsh,
even 4.0.x, so we should think about it pretty carefully.
} The subshell exits without ever leaving the scope of fn(), so the EXIT trap
} isn't called in this case.
Hrm. Try these variants (with `fn' as above):
zsh% trap 'print PS1-level' EXIT; fn #1
zsh% (trap 'print PS1-level' EXIT; fn) #2
zsh% trap 'print PS1-level' EXIT; (exit) #3
zsh% function TRAPEXIT { print PS1-level }; (exit) #4
PS1-level
zsh% function TRAPEXIT { print PS1-level }; fn #5
zsh%
What's the excuse for the PS1-level trap not running any case but #4?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2001-10-01 16:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-01 12:01 Peter Stephenson
2001-10-01 16:01 ` Bart Schaefer [this message]
2001-10-02 10:23 ` Peter Stephenson
2001-10-02 14:19 ` Bart Schaefer
2001-10-02 14:39 ` Peter Stephenson
2001-10-02 15:19 ` Bart Schaefer
2001-10-02 15:32 ` Peter Stephenson
2001-10-02 16:03 ` Bart Schaefer
2001-10-03 15:18 ` PATCH: (2) " Peter Stephenson
2001-10-03 16:16 ` Bart Schaefer
2001-10-08 8:10 ` Peter Stephenson
2001-10-08 9:56 ` Bart Schaefer
2001-10-08 10:32 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1011001160158.ZM23006@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).