summaryrefslogtreecommitdiff
path: root/plugins/brew/brew.plugin.zsh
diff options
context:
space:
mode:
authortmoschou <5567550+tmoschou@users.noreply.github.com>2022-10-15 04:57:42 +1030
committerGitHub <noreply@github.com>2022-10-14 20:27:42 +0200
commitc7c0a8917b8ded7511c07105c82bd7417b92f7a3 (patch)
treeff24bea485b94bc70a82082295468979147e40bf /plugins/brew/brew.plugin.zsh
parent34cd8fbd4afce7b2beb3292f4f90ca57142f442c (diff)
downloadzsh-c7c0a8917b8ded7511c07105c82bd7417b92f7a3.tar.gz
zsh-c7c0a8917b8ded7511c07105c82bd7417b92f7a3.tar.bz2
zsh-c7c0a8917b8ded7511c07105c82bd7417b92f7a3.zip
fix(brew): do not source `brew shellenv` if already on path (#11167)
Diffstat (limited to 'plugins/brew/brew.plugin.zsh')
-rw-r--r--plugins/brew/brew.plugin.zsh17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index 4a2322216..41420b5b7 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -10,18 +10,21 @@ if (( ! $+commands[brew] )); then
else
return
fi
+
+ # Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
+ # not already on the path, to prevent duplicate entries. This aligns with
+ # the behavior of the brew installer.sh post-install steps.
+ eval "$("$BREW_LOCATION" shellenv)"
+ unset BREW_LOCATION
fi
if [[ -z "$HOMEBREW_PREFIX" ]]; then
- if [[ -z $BREW_LOCATION ]]; then
- eval "$(brew shellenv)"
- else
- eval "$("$BREW_LOCATION" shellenv)"
- fi
+ # Maintain compatability with potential custom user profiles, where we had
+ # previously relied on always sourcing shellenv. OMZ plugins should not rely
+ # on this to be defined due to out of order processing.
+ export HOMEBREW_PREFIX="$(brew --prefix)"
fi
-unset BREW_LOCATION
-
alias bcubc='brew upgrade --cask && brew cleanup'
alias bcubo='brew update && brew outdated --cask'
alias brewp='brew pin'