diff options
| author | Jack Nagel | 2014-07-06 13:35:44 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-06 13:35:44 -0500 |
| commit | 7bd4f76b8ca090e3dd266e68e0a7fe1b1c41277b (patch) | |
| tree | 42c3f6cdba4e78cd2aeabbd0bad46407d1651f49 | |
| parent | 6a0720071e32b7e4031db0470bc9fb3056f46a75 (diff) | |
| download | brew-7bd4f76b8ca090e3dd266e68e0a7fe1b1c41277b.tar.bz2 | |
Check File.file? first to avoid second stat()
| -rw-r--r-- | Library/Homebrew/utils.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 0bbf8a795..bdc51ebfa 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -185,7 +185,7 @@ end def which cmd, path=ENV['PATH'] path.split(File::PATH_SEPARATOR).each do |p| pcmd = File.expand_path(File.join(p, cmd)) - return Pathname.new(pcmd) if File.executable?(pcmd) && !File.directory?(pcmd) + return Pathname.new(pcmd) if File.file?(pcmd) && File.executable?(pcmd) end return nil end |
