about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-03-02 22:05:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-03-02 22:05:21 +0000
commit31f6b3fb07ec0d5816c2dabbc314009c3126b58b (patch)
tree42e83d51173372b3b7924128442b585dc5766b6f /Src/builtin.c
parentb4273451f367d23b1d0d173b4f8687670a8fe1d6 (diff)
downloadzsh-31f6b3fb07ec0d5816c2dabbc314009c3126b58b.tar.gz
zsh-31f6b3fb07ec0d5816c2dabbc314009c3126b58b.tar.xz
zsh-31f6b3fb07ec0d5816c2dabbc314009c3126b58b.zip
22317: exit status from code backgrounded in function
22277, 22281, tweaks: standardize behaviour of wait builtin
with trapped signals
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 1b7e1935e..d51149ec6 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4119,12 +4119,15 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
 	}
 	/*FALLTHROUGH*/
     case BIN_EXIT:
-	if (locallevel) {
+	if (locallevel > forklevel) {
 	    /*
 	     * We don't exit directly from functions to allow tidying
 	     * up, in particular EXIT traps.  We still need to perform
 	     * the usual interactive tests to see if we can exit at
 	     * all, however.
+	     *
+	     * If we are forked, we exit the shell at the function depth
+	     * at which we became a subshell, hence the comparison.
 	     */
 	    if (stopmsg || (zexit(0,2), !stopmsg)) {
 		retflag = 1;