Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS
- X-seq: zsh-workers 25385
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS
- Date: Mon, 4 Aug 2008 18:49:57 +0100
- In-reply-to: <6cd6de210808040308k529da37dh40b8dd1799086420@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <6cd6de210808040308k529da37dh40b8dd1799086420@xxxxxxxxxxxxxx>
On Mon, 4 Aug 2008 06:08:39 -0400
"Rocky Bernstein" <rocky.bernstein@xxxxxxxxx> wrote:
> The following code doesn't show $? as nonzero inside trap DEBUG using the
> CVS source I just downloaded and built.
>
> However I don't get this problem on the Ubuntu zsh-beta or zsh.
> Removing DEBUG_BEFORE_CMD (or I guess having debug run after the
> command) does set/show $? properly.
>
> #!/tmp/zsh/Src/zsh -f
> #!/src/external-cvs/zsh/Src/zsh -f
> set -o DEBUG_BEFORE_CMD
> trap 'print $?' DEBUG
> fdasfsdafd # invalid command
> :
Turns out to be unfinished business with the previous patch: that code I
patched needs also to be told when we're not in a trap at all. It was
triggering after the trap, resetting the status.
I must write tests for both.
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.89
diff -u -r1.89 init.c
--- Src/init.c 4 Aug 2008 17:32:20 -0000 1.89
+++ Src/init.c 4 Aug 2008 17:46:26 -0000
@@ -191,7 +191,7 @@
exit(lastval);
if (((!interact || sourcelevel) && errflag) || retflag)
break;
- if (trapreturn >= 0) {
+ if (intrap && trapreturn >= 0) {
lastval = trapreturn;
trapreturn = 0;
}
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author