aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMike McQuaid2013-02-17 13:30:58 +0000
committerMike McQuaid2013-02-18 10:42:43 +0000
commite9d58c410052157487f96a77dd318cbda641806e (patch)
tree9858337126d17a6fbb6f0959b913b545c6412972 /bin
parentbeff735d3f916ec0bd453025fb4b610bbb72b640 (diff)
downloadbrew-e9d58c410052157487f96a77dd318cbda641806e.tar.bz2
Rework brew command dispatch order.
Make it no longer possible to override e.g. `brew install` with a script if there is already a built-in Homebrew command named `brew install`. References Homebrew/homebrew#17673
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/brew b/bin/brew
index 1ade4c30b..5fd2fc82a 100755
--- a/bin/brew
+++ b/bin/brew
@@ -83,15 +83,15 @@ begin
# Add example external commands to PATH before checking.
ENV['PATH'] += ":#{HOMEBREW_REPOSITORY}/Library/Contributions/cmds"
- if which "brew-#{cmd}"
+ if require? HOMEBREW_REPOSITORY/"Library/Homebrew/cmd"/cmd
+ Homebrew.send cmd.to_s.gsub('-', '_').downcase
+ elsif which "brew-#{cmd}"
%w[CACHE CELLAR LIBRARY_PATH PREFIX REPOSITORY].each do |e|
ENV["HOMEBREW_#{e}"] = Object.const_get "HOMEBREW_#{e}"
end
exec "brew-#{cmd}", *ARGV
elsif require? `/usr/bin/which brew-#{cmd}.rb`
exit 0
- elsif require? HOMEBREW_REPOSITORY/"Library/Homebrew/cmd"/cmd
- Homebrew.send cmd.to_s.gsub('-', '_').downcase
else
onoe "Unknown command: #{cmd}"
exit 1