From ac84a4b051ae0df584975234f3636e159f123ecc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 3 Dec 2020 16:52:54 +0000 Subject: [PATCH] Fix ZSH FPATH handling Don't require it to be exported but shell out to `zsh` instead. Fixes https://github.com/Homebrew/brew/issues/9387 --- Library/Homebrew/caveats.rb | 3 ++- bin/brew | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index aade446ef0..a80b49aa43 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -133,7 +133,8 @@ class Caveats zsh #{installed.join(" and ")} have been installed to: #{site_functions} EOS - unless PATH.new(ENV["HOMEBREW_FPATH"]).to_a.include?(site_functions.to_s) + zsh = which("zsh") || which("zsh", ENV["HOMEBREW_PATH"]) + if zsh.present? && Utils.popen_read("'#{zsh}' -ic 'echo $FPATH'").exclude?(site_functions.to_s) zsh_caveats << <<~EOS #{site_functions} is not in your zsh FPATH! diff --git a/bin/brew b/bin/brew index 7bfe4b696e..d247d13264 100755 --- a/bin/brew +++ b/bin/brew @@ -62,7 +62,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library" # Copy and export all HOMEBREW_* variables previously mentioned in # manpage or used elsewhere by Homebrew. -for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH FPATH +for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue