summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c7
-rw-r--r--Src/params.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index a147dacd5..e638b9f6e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -910,6 +910,13 @@ entersubsh(int flags)
}
if (!(flags & ESUB_FAKE))
subsh = 1;
+ /*
+ * Increment the visible parameter ZSH_SUBSHELL even if this
+ * is a fake subshell because we are exec'ing at the end.
+ * Logically this should be equivalent to a real subshell so
+ * we don't hang out the dirty washing.
+ */
+ zsh_subshell++;
if ((flags & ESUB_REVERTPGRP) && getpid() == mypgrp)
release_pgrp();
if (SHTTY != -1) {
diff --git a/Src/params.c b/Src/params.c
index 0bd909905..39bc8515a 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -85,7 +85,8 @@ zlong lastval, /* $? */
lastpid, /* $! */
columns, /* $COLUMNS */
lines, /* $LINES */
- ppid; /* $PPID */
+ ppid, /* $PPID */
+ zsh_subshell; /* $ZSH_SUBSHELL */
/**/
zlong lineno, /* $LINENO */
zoptind, /* $OPTIND */
@@ -291,6 +292,7 @@ IPDEF4("?", &lastval),
IPDEF4("HISTCMD", &curhist),
IPDEF4("LINENO", &lineno),
IPDEF4("PPID", &ppid),
+IPDEF4("ZSH_SUBSHELL", &zsh_subshell),
#define IPDEF5(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL},BR((void *)B),GSU(varinteger_gsu),10,0,NULL,NULL,NULL,0}
IPDEF5("COLUMNS", &columns, zlevar_gsu),