aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 519b2869a..8c7329652 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -170,7 +170,10 @@ def puts_columns items, star_items=[]
end
def which cmd, path=ENV['PATH']
- dir = path.split(File::PATH_SEPARATOR).find {|p| File.executable? File.join(p, cmd)}
+ dir = path.split(File::PATH_SEPARATOR).find {|p|
+ pcmd = File.join(p, cmd)
+ File.executable?(pcmd) && !File.directory?(pcmd)
+ }
Pathname.new(File.join(dir, cmd)) unless dir.nil?
end