aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/diagnostic.rb6
-rw-r--r--Library/Homebrew/test/diagnostic_spec.rb2
-rw-r--r--Library/Homebrew/utils.rb4
3 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index 51a892e28..e1b1bb8ee 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -434,7 +434,7 @@ module Homebrew
message = ""
- paths(ENV["HOMEBREW_PATH"]).each do |p|
+ paths.each do |p|
case p
when "/usr/bin"
unless @seen_prefix_bin
@@ -577,7 +577,7 @@ module Homebrew
/Applications/Server.app/Contents/ServerRoot/usr/sbin
].map(&:downcase)
- paths(ENV["HOMEBREW_PATH"]).each do |p|
+ paths.each do |p|
next if whitelist.include?(p.downcase) || !File.directory?(p)
realpath = Pathname.new(p).realpath.to_s
@@ -1045,7 +1045,7 @@ module Homebrew
end
def check_for_external_cmd_name_conflict
- cmds = paths.flat_map { |p| Dir["#{p}/brew-*"] }.uniq
+ cmds = Tap.cmd_directories.flat_map { |p| Dir["#{p}/brew-*"] }.uniq
cmds = cmds.select { |cmd| File.file?(cmd) && File.executable?(cmd) }
cmd_map = {}
cmds.each do |cmd|
diff --git a/Library/Homebrew/test/diagnostic_spec.rb b/Library/Homebrew/test/diagnostic_spec.rb
index 8a25413ed..f347010a9 100644
--- a/Library/Homebrew/test/diagnostic_spec.rb
+++ b/Library/Homebrew/test/diagnostic_spec.rb
@@ -194,7 +194,7 @@ describe Homebrew::Diagnostic::Checks do
FileUtils.chmod 0755, cmd
end
- ENV["PATH"] = [path1, path2, ENV["PATH"]].join File::PATH_SEPARATOR
+ allow(Tap).to receive(:cmd_directories).and_return([path1, path2])
expect(subject.check_for_external_cmd_name_conflict)
.to match("brew-foo")
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 1d16044da..48ab94c4f 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -420,8 +420,8 @@ def nostdout
end
end
-def paths(env_path = ENV["PATH"])
- @paths ||= PATH.new(env_path).collect do |p|
+def paths
+ @paths ||= PATH.new(ENV["HOMEBREW_PATH"]).collect do |p|
begin
File.expand_path(p).chomp("/")
rescue ArgumentError