aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2014-03-16 11:52:11 -0700
committerAdam Vandenberg2014-03-16 11:52:11 -0700
commitf54201355fff2ff540ddd6a03d789889a8571d10 (patch)
tree3e8b7e7751c34f72193f8e8fdb247e60b09b7e13 /Library
parent8c3c7ecccc8c3d7b0ce4c399c4c7543b4900f9db (diff)
downloadhomebrew-f54201355fff2ff540ddd6a03d789889a8571d10.tar.bz2
return found path directly in which
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 8c7329652..9c78b91a0 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -170,11 +170,11 @@ def puts_columns items, star_items=[]
end
def which cmd, path=ENV['PATH']
- dir = path.split(File::PATH_SEPARATOR).find {|p|
+ path.split(File::PATH_SEPARATOR).find do |p|
pcmd = File.join(p, cmd)
- File.executable?(pcmd) && !File.directory?(pcmd)
- }
- Pathname.new(File.join(dir, cmd)) unless dir.nil?
+ return pcmd if File.executable?(pcmd) && !File.directory?(pcmd)
+ end
+ return nil
end
def which_editor