From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: zshexit hook
Date: Wed, 08 Nov 2006 18:04:42 +0000 [thread overview]
Message-ID: <200611081804.kA8I4gXl007443@news01.csr.com> (raw)
I think, now we have proper hooks, we need a hook on exit, since the
same issues can occur with TRAPEXIT as with precmd etc.; also it
means something different within a function, so always feels like a bit
of a hack.
The code is now trivial (and won't cause an endless loop any more).
I've called the zshexit; can anyone think of a better name,
i.e. something memorable which won't clash with user functions?
Index: Doc/Zsh/func.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/func.yo,v
retrieving revision 1.13
diff -u -r1.13 func.yo
--- Doc/Zsh/func.yo 8 Nov 2006 10:38:05 -0000 1.13
+++ Doc/Zsh/func.yo 8 Nov 2006 18:03:24 -0000
@@ -203,6 +203,14 @@
elided); the third argument contains the full text that is being
executed.
)
+findex(zshexit)
+vindex(zshexit_functions)
+item(tt(zshexit))(
+Exited at the point where the main shell is about to exit normally.
+This is not called by exiting subshells, nor when the tt(exec)
+precommand modifier is used before an external command. Also, unlike
+tt(TRAPEXIT), it is not called when functions exit.
+)
item(tt(TRAP)var(NAL))(
cindex(signals, trapping)
cindex(trapping signals)
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.167
diff -u -r1.167 builtin.c
--- Src/builtin.c 8 Nov 2006 17:43:32 -0000 1.167
+++ Src/builtin.c 8 Nov 2006 18:03:27 -0000
@@ -4436,6 +4436,7 @@
}
if (sigtrapped[SIGEXIT])
dotrap(SIGEXIT);
+ callhookfunc("zshexit", NULL, 1);
runhookdef(EXITHOOK, NULL);
if (opts[MONITOR] && interact && (SHTTY != -1)) {
release_pgrp();
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
reply other threads:[~2006-11-08 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200611081804.kA8I4gXl007443@news01.csr.com \
--to=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).