diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 8c73296525..9c78b91a05 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