From c56fff39280b6d059f72cdf999f93d705d045c10 Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Mon, 11 Jan 2021 21:01:45 +0900 Subject: [PATCH] cmd/prof: raise error when cmd is bash file --- Library/Homebrew/brew.rb | 2 -- Library/Homebrew/commands.rb | 4 ---- Library/Homebrew/dev-cmd/prof.rb | 2 ++ 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index cab8b2a852..ca712613e4 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -131,8 +131,6 @@ begin end exec "brew-#{cmd}", *ARGV else - raise "command made by bash not ruby: #{cmd}" if Commands.only_bash_command_list.include?(cmd) - possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) } possible_tap = Tap.fetch(possible_tap.first) if possible_tap diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index d725a0bafd..0fd56c5838 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -197,8 +197,4 @@ module Commands file = HOMEBREW_CACHE/"all_commands_list.txt" file.atomic_write("#{commands(aliases: true).sort.join("\n")}\n") end - - def only_bash_command_list - internal_commands.reject { |cmd| valid_internal_cmd?(cmd) } - end end diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index add6a5ae01..1fd6a762da 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -26,6 +26,8 @@ module Homebrew brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path FileUtils.mkdir_p "prof" + cmd = args.named.first + raise UsageError, "#{cmd} is a Bash command!" if Commands.path(cmd).extname == ".sh" if args.stackprof? Homebrew.install_gem_setup_path! "stackprof"