Merge pull request #11379 from carlocab/tmux-env-filtering

Fix `TMUX` env variable filtering
This commit is contained in:
Carlo Cabrera 2021-05-14 19:12:47 +01:00 committed by GitHub
commit 496c24aae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class Caveats
# pbpaste is the system clipboard tool on macOS and fails with `tmux` by default # pbpaste is the system clipboard tool on macOS and fails with `tmux` by default
# check if this is being run under `tmux` to avoid failing # check if this is being run under `tmux` to avoid failing
if ENV["TMUX"] && !quiet_system("/usr/bin/pbpaste") if ENV["HOMEBREW_TMUX"] && !quiet_system("/usr/bin/pbpaste")
s << "" << "WARNING: brew services will fail when run under tmux." s << "" << "WARNING: brew services will fail when run under tmux."
end end
"#{s.join("\n")}\n" unless s.empty? "#{s.join("\n")}\n" unless s.empty?

View File

@ -135,7 +135,7 @@ describe Caveats do
"plist_test.plist" "plist_test.plist"
end end
end end
ENV["TMUX"] = "1" ENV["HOMEBREW_TMUX"] = "1"
allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false) allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false)
caveats = described_class.new(f).caveats caveats = described_class.new(f).caveats

View File

@ -64,7 +64,7 @@ HOMEBREW_LIBRARY="${HOMEBREW_REPOSITORY}/Library"
# Copy and export all HOMEBREW_* variables previously mentioned in # Copy and export all HOMEBREW_* variables previously mentioned in
# manpage or used elsewhere by Homebrew. # manpage or used elsewhere by Homebrew.
for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH TMUX
do do
# Skip if variable value is empty. # Skip if variable value is empty.
[[ -z "${!VAR}" ]] && continue [[ -z "${!VAR}" ]] && continue