From 0ee67f042872d1dfab74270c31867771ca35aef4 Mon Sep 17 00:00:00 2001 From: fudian Date: Wed, 16 Sep 2026 16:47:20 +0800 Subject: [PATCH] fix(cli): fallback to zsh when ZSH_ARGZERO is not abs path (#13922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 付典 --- lib/cli.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cli.zsh b/lib/cli.zsh index 6605fe66d..48fa8995b 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -738,6 +738,9 @@ function _omz::reload { # Old zsh versions don't have ZSH_ARGZERO local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve + # anything that is not absolute (see #13919) + [[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="$commands[zsh]" # Check whether to run a login shell [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" } @@ -919,6 +922,9 @@ function _omz::update { if [[ "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then # Old zsh versions don't have ZSH_ARGZERO local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve + # anything that is not absolute (see #13919) + [[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="$commands[zsh]" # Check whether to run a login shell [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" fi