Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: zshexit hook
- X-seq: zsh-workers 22984
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: zshexit hook
- Date: Wed, 08 Nov 2006 18:04:42 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author