summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-08-24 17:48:39 +0200
committerMarc Cornellà <marc.cornella@live.com>2020-08-24 17:48:39 +0200
commitcfb86cd08d3b24fd4b59d0d35b3af1f589c891fa (patch)
tree5ad85466c07263b400df72d0fced63cf4f77624a /plugins
parentcd17aed9e109692273b5c251414ee733cba704f2 (diff)
downloadzsh-cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa.tar.gz
zsh-cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa.tar.bz2
zsh-cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa.zip
zsh_reload: use $SHELL to reload zsh only if it's a zsh shell (fixes #9054)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/zsh_reload/zsh_reload.plugin.zsh14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
index 83f8da733..0d29a7ce3 100644
--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -7,6 +7,16 @@ src() {
zrecompile -p $f && command rm -f $f.zwc.old
done
- # Use $SHELL if available; remove leading dash if login shell
- [[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
+ # Use $SHELL if it's available and a zsh shell
+ local shell="$ZSH_ARGZERO"
+ if [[ "${${SHELL:t}#-}" = zsh ]]; then
+ shell="$SHELL"
+ fi
+
+ # Remove leading dash if login shell and run accordingly
+ if [[ "${shell:0:1}" = "-" ]]; then
+ exec -l "${shell#-}"
+ else
+ exec "$shell"
+ fi
}