f64cabc780496636b3e4f5283ef8d77c23f18e92

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(cli): make sure to run `zsh` command if an alias exists (#9737)

Fixes #9737

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index 2f3f293da99d5644802d182281d128db94a9af91..edc10e722d780055b2437f39cf73614df0407665 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -289,7 +289,7 @@ multi == 1 && length(\$0) > 0 {
 6   }
 7 
 8   # Exit if the new .zshrc file has syntax errors
 9-  if ! zsh -n "$zdot/.zshrc"; then
10+  if ! command zsh -n "$zdot/.zshrc"; then
11     _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
12     command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
13     command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
14@@ -365,7 +365,7 @@ multi == 1 && /^[^#]*\)/ {
15   }
16 
17   # Exit if the new .zshrc file has syntax errors
18-  if ! zsh -n "$zdot/.zshrc"; then
19+  if ! command zsh -n "$zdot/.zshrc"; then
20     _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
21     command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
22     command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
23@@ -721,7 +721,7 @@ EOF
24   }
25 
26   # Exit if the new .zshrc file has syntax errors
27-  if ! zsh -n "$zdot/.zshrc"; then
28+  if ! command zsh -n "$zdot/.zshrc"; then
29     _omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
30     command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
31     command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
32@@ -765,9 +765,9 @@ function _omz::update {
33 
34   # Run update script
35   if [[ "$1" != --unattended ]]; then
36-    ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
37+    ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
38   else
39-    ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" || return $?
40+    ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" || return $?
41   fi
42 
43   # Update last updated file