Skip to content

Commit

Permalink
cmd/prof: raise error when cmd is bash file
Browse files Browse the repository at this point in the history
  • Loading branch information
hyuraku committed Jan 11, 2021
1 parent e896c5c commit c56fff3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Library/Homebrew/brew.rb
Expand Up @@ -131,8 +131,6 @@ class MissingEnvironmentVariables < RuntimeError; end
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

Expand Down
4 changes: 0 additions & 4 deletions Library/Homebrew/commands.rb
Expand Up @@ -197,8 +197,4 @@ def rebuild_commands_completion_list
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
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/prof.rb
Expand Up @@ -26,6 +26,8 @@ def prof

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"
Expand Down

0 comments on commit c56fff3

Please sign in to comment.