mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-28 22:16:05 +02:00
fix(cli): re-resolve zsh at exec time to avoid a stale command hash (#14104)
Signed-off-by: 付典 <fudianchn@gmail.com>
This commit is contained in:
+4
-4
@@ -739,8 +739,8 @@ function _omz::reload {
|
|||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
||||||
# anything that is not absolute (see #13919)
|
# anything that is not absolute via $PATH at exec time (see #13919)
|
||||||
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="$commands[zsh]"
|
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="zsh"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
}
|
}
|
||||||
@@ -923,8 +923,8 @@ function _omz::update {
|
|||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
||||||
# anything that is not absolute (see #13919)
|
# anything that is not absolute via $PATH at exec time (see #13919)
|
||||||
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="$commands[zsh]"
|
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="zsh"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user