cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

zsh_reload: use $SHELL to reload zsh only if it's a zsh shell (fixes #9054)

Diff

 1diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
 2index 83f8da7332e2cd6b8d25bbd7380e4870273f284a..0d29a7ce301780faab403fb93a1abfd5c17578ce 100644
 3--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
 4+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
 5@@ -7,6 +7,16 @@ src() {
 6 		zrecompile -p $f && command rm -f $f.zwc.old
 7 	done
 8 
 9-	# Use $SHELL if available; remove leading dash if login shell
10-	[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
11+	# Use $SHELL if it's available and a zsh shell
12+	local shell="$ZSH_ARGZERO"
13+	if [[ "${${SHELL:t}#-}" = zsh ]]; then
14+		shell="$SHELL"
15+	fi
16+
17+	# Remove leading dash if login shell and run accordingly
18+	if [[ "${shell:0:1}" = "-" ]]; then
19+		exec -l "${shell#-}"
20+	else
21+		exec "$shell"
22+	fi
23 }