cmd/prof: raise error when cmd is bash file
This commit is contained in:
parent
e896c5c4cf
commit
c56fff3928
@ -131,8 +131,6 @@ begin
|
|||||||
end
|
end
|
||||||
exec "brew-#{cmd}", *ARGV
|
exec "brew-#{cmd}", *ARGV
|
||||||
else
|
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 = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
|
||||||
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
||||||
|
|
||||||
|
|||||||
@ -197,8 +197,4 @@ module Commands
|
|||||||
file = HOMEBREW_CACHE/"all_commands_list.txt"
|
file = HOMEBREW_CACHE/"all_commands_list.txt"
|
||||||
file.atomic_write("#{commands(aliases: true).sort.join("\n")}\n")
|
file.atomic_write("#{commands(aliases: true).sort.join("\n")}\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def only_bash_command_list
|
|
||||||
internal_commands.reject { |cmd| valid_internal_cmd?(cmd) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -26,6 +26,8 @@ module Homebrew
|
|||||||
|
|
||||||
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
||||||
FileUtils.mkdir_p "prof"
|
FileUtils.mkdir_p "prof"
|
||||||
|
cmd = args.named.first
|
||||||
|
raise UsageError, "#{cmd} is a Bash command!" if Commands.path(cmd).extname == ".sh"
|
||||||
|
|
||||||
if args.stackprof?
|
if args.stackprof?
|
||||||
Homebrew.install_gem_setup_path! "stackprof"
|
Homebrew.install_gem_setup_path! "stackprof"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user