diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-05 21:02:08 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-09-05 21:02:08 +0000 |
commit | db31a13ecdd8306aad63319ace28bf7d029d4829 (patch) | |
tree | e57d6287ae80fb12341a32eae7b8bc0f4d5f2711 /Src | |
parent | 7ce1d5735832e51bc13e255f2e8549873c9688ff (diff) | |
download | zsh-db31a13ecdd8306aad63319ace28bf7d029d4829.tar.gz zsh-db31a13ecdd8306aad63319ace28bf7d029d4829.tar.xz zsh-db31a13ecdd8306aad63319ace28bf7d029d4829.zip |
25627: add $ZSH_SUBSHELL
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 7 | ||||
-rw-r--r-- | Src/params.c | 4 |
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), |