aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 0d1b63c8b..348dbbdea 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -152,12 +152,8 @@ def puts_columns items, star_items=[]
end
def which cmd
- path = `/usr/bin/which #{cmd} 2>/dev/null`.chomp
- if path.empty?
- nil
- else
- Pathname.new(path)
- end
+ dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
+ Pathname.new(File.join(dir, cmd)) unless dir.nil?
end
def which_editor