b79726b1c33149a429bbade49e9567a08ffa98af

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

Message

fix(update): silence `typeset` calls in `upgrade.sh` script (#10048)

Co-authored-by: yyny <6576327+yyny@users.noreply.github.com>

Diff

 1diff --git a/tools/upgrade.sh b/tools/upgrade.sh
 2index e9f8bc0f91a3ce810fd5e726ae5b131954b609f7..7dec398fd6f8f93638c7796753bd32b6257e7ec0 100755
 3--- a/tools/upgrade.sh
 4+++ b/tools/upgrade.sh
 5@@ -1,16 +1,23 @@
 6 #!/usr/bin/env zsh
 7 
 8+# Protect against running with shells other than zsh
 9 if [ -z "$ZSH_VERSION" ]; then
10   exec zsh "$0" "$@"
11 fi
12 
13+# Protect against unwanted sourcing
14+case "$ZSH_EVAL_CONTEXT" in
15+  *:file) echo "error: this file should not be sourced" && return ;;
16+esac
17+
18 cd "$ZSH"
19 
20 # Use colors, but only if connected to a terminal
21 # and that terminal supports them.
22 
23-local -a RAINBOW
24-local RED GREEN YELLOW BLUE BOLD DIM UNDER RESET
25+setopt typeset_silent
26+typeset -a RAINBOW
27+typeset RED GREEN YELLOW BLUE BOLD DIM UNDER RESET
28 
29 if [ -t 1 ]; then
30   RAINBOW=(