diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index 4500f1eb5e..27b67f1cb3 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -355,19 +355,6 @@ module Kernel nil end - def which_all(cmd, path = ENV.fetch("PATH")) - PATH.new(path).filter_map do |p| - begin - pcmd = File.expand_path(cmd, p) - rescue ArgumentError - # File.expand_path will raise an ArgumentError if the path is malformed. - # See https://github.com/Homebrew/legacy-homebrew/issues/32789 - next - end - Pathname.new(pcmd) if File.file?(pcmd) && File.executable?(pcmd) - end.uniq - end - def which_editor(silent: false) editor = Homebrew::EnvConfig.editor return editor if editor diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 82851e5ad6..ac38b7418a 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -172,10 +172,6 @@ class Requirement super(cmd, PATH.new(ORIGINAL_PATHS)) end - def which_all(cmd) - super(cmd, PATH.new(ORIGINAL_PATHS)) - end - class << self include BuildEnvironment::DSL diff --git a/Library/Homebrew/test/extend/kernel_spec.rb b/Library/Homebrew/test/extend/kernel_spec.rb index 238f4573e3..7d595d3f8a 100644 --- a/Library/Homebrew/test/extend/kernel_spec.rb +++ b/Library/Homebrew/test/extend/kernel_spec.rb @@ -144,32 +144,6 @@ RSpec.describe Kernel do end end - describe "#which_all" do - let(:cmd_foo) { dir/"foo" } - let(:cmd_foo_bar) { dir/"bar/foo" } - let(:cmd_bar_baz_foo) { dir/"bar/baz/foo" } - - before do - (dir/"bar/baz").mkpath - - FileUtils.touch cmd_foo_bar - - [cmd_foo, cmd_bar_baz_foo].each do |cmd| - FileUtils.touch cmd - cmd.chmod 0744 - end - end - - it "returns an array of all executables that are found" do - path = [ - "#{dir}/bar/baz", - "#{dir}/baz:#{dir}", - "~baduserpath", - ].join(File::PATH_SEPARATOR) - expect(which_all("foo", path)).to eq([cmd_bar_baz_foo, cmd_foo]) - end - end - specify "#which_editor" do ENV["HOMEBREW_EDITOR"] = "vemate -w" ENV["HOMEBREW_PATH"] = dir