7d32e7fc3fb56032252548a690744a26c3ac3059

Author
Marc Cornellà <marc@mcornella.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(updater): detect p10k instant prompt (#12971)

Fixes #12781

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2index 1ecab5c0bf023e75fcd3627fcd50de17590e59d7..35391ea70e30d248993682e2a05a23e32d07e6d6 100644
 3--- a/tools/check_for_upgrade.sh
 4+++ b/tools/check_for_upgrade.sh
 5@@ -27,7 +27,7 @@ zstyle -s ':omz:update' mode update_mode || {
 6 # - $ZSH is not a git repository
 7 if [[ "$update_mode" = disabled ]] \
 8    || [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
 9-   || [[ ! -t 1 ]] \
10+   || [[ ! -t 1 && ${POWERLEVEL9K_INSTANT_PROMPT:-off} == off ]] \
11    || ! command git --version 2>&1 >/dev/null \
12    || (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
13   unset update_mode
14@@ -112,6 +112,11 @@ function update_ohmyzsh() {
15   local verbose_mode
16   zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
17 
18+  # Force verbose mode to silent if p10k instant prompt is enabled
19+  if [[ ${POWERLEVEL9K_INSTANT_PROMPT:-off} != "off" ]]; then
20+    verbose_mode=silent
21+  fi
22+
23   if [[ "$update_mode" != background-alpha ]] \
24     && LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode; then
25     update_last_updated_file