summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-10-13 17:54:28 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-10-13 17:54:28 +0000
commit594ad37c37540735068e24387db7fbf524de9c8c (patch)
tree95f9f0357684f9b880f1d444d2e0963da1c31e52
parentd0303296cdd465703ef95930ac254b73280b66bf (diff)
downloadzsh-594ad37c37540735068e24387db7fbf524de9c8c.tar.gz
zsh-594ad37c37540735068e24387db7fbf524de9c8c.zip
Save/restore state around DEBUG trap call.
-rw-r--r--ChangeLog6
-rw-r--r--Src/exec.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f2573921..931e2fd1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-11 Bart Schaefer <schaefer@zsh.org>
+
+ * 16013: Src/exec.c: Properly save/restore state around the
+ DEBUG trap, so that its return value does not alter the return
+ value of current command (among other things).
+
2001-10-11 Sven Wischnowsky <wischnow@zsh.org>
* 16002: Completion/Unix/Type/_path_files: use expanded paths
diff --git a/Src/exec.c b/Src/exec.c
index 7bc341116..ed8293b24 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -886,11 +886,18 @@ execlist(Estate state, int dont_change_job, int exiting)
state->pc--;
sublist_done:
- cmdsp = csp;
noerrexit = oldnoerrexit;
- if (sigtrapped[SIGDEBUG])
+ if (sigtrapped[SIGDEBUG]) {
+ exiting = donetrap;
+ ret = lastval;
dotrap(SIGDEBUG);
+ lastval = ret;
+ donetrap = exiting;
+ noerrexit = oldnoerrexit;
+ }
+
+ cmdsp = csp;
/* Check whether we are suppressing traps/errexit *
* (typically in init scripts) and if we haven't *