fix(CLI): properly get zsh command in `omz update` (#9558)
Zsh versions older than 5.3 don't have ZSH_ARGZERO, so use an alternative
method to get the zsh command.
Fixes #9558
Diff
1diff --git a/lib/cli.zsh b/lib/cli.zsh
2index 92d447a8e2c3c2dcd5d71017943a70423fddfce7..6fcffdf878b37eaaef279e912b8031fe92837447 100644
3--- a/lib/cli.zsh
4+++ b/lib/cli.zsh
5@@ -391,7 +391,9 @@ function _omz::update {
6 7 # Restart the zsh session
8 if [[ $ret -eq 0 && "$1" != --unattended ]]; then
9+ # Old zsh versions don't have ZSH_ARGZERO
10+ local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
11 # Check whether to run a login shell
12- [[ "$ZSH_ARGZERO" = -* ]] && exec -l "${ZSH_ARGZERO#-}" || exec "$ZSH_ARGZERO"
13+ [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
14 fi
15 }