aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorkynnjo2014-03-13 17:20:36 -0400
committerAdam Vandenberg2014-03-16 11:49:35 -0700
commit5f8e78150e47f2f68c5239a644198968398eb9e3 (patch)
tree72a3f13cb28549a7bececf01ebf9e00ff5c93324 /Library
parentc84c8b1d0e5cd9759c32ea220359a15e2ba4ad5e (diff)
downloadbrew-5f8e78150e47f2f68c5239a644198968398eb9e3.tar.bz2
utils.rb:which: bug fix
Closes Homebrew/homebrew#27524. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
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