diff options
author | Stephane Chazelas <stephane.chazelas@gmail.com> | 2016-08-30 13:44:26 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-08-31 10:21:00 +0100 |
commit | 8ce98c75f5330eecfa474e342146b8d057abcefc (patch) | |
tree | e6a98cc00046134c2e30c214a8a5282fe193a044 /Src | |
parent | 70166178bdc7ea149eb1cd29bcdb549a392c46dd (diff) | |
download | zsh-8ce98c75f5330eecfa474e342146b8d057abcefc.tar.gz zsh-8ce98c75f5330eecfa474e342146b8d057abcefc.tar.xz zsh-8ce98c75f5330eecfa474e342146b8d057abcefc.zip |
39125: More care needed decrementing SHLVL on exec.
Not needed in subshell.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c index 9b24d388e..2e251b939 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3694,12 +3694,15 @@ execcmd(Estate state, int input, int output, int how, int last1) restore_params(restorelist, removelist); } else { - if (!forked) - setiparam("SHLVL", --shlvl); - if (do_exec) { + if (!subsh) { + /* for either implicit or explicit "exec", decrease $SHLVL + * as we're now done as a shell */ + if (!forked) + setiparam("SHLVL", --shlvl); + /* If we are exec'ing a command, and we are not * * in a subshell, then save the history file. */ - if (!subsh && isset(RCS) && interact && !nohistsave) + if (do_exec && isset(RCS) && interact && !nohistsave) savehistfile(NULL, 1, HFILE_USE_OPTIONS); } if (type == WC_SIMPLE || type == WC_TYPESET) { |