diff options
| author | Jack Nagel | 2014-07-06 13:35:44 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-06 13:35:44 -0500 |
| commit | 53db7cf17ec0ee3518b91d9fce0183e9f53ab7ee (patch) | |
| tree | dfcf8eca94e2055f009b65e276628b4177dd32d8 /Library | |
| parent | eca3de1bc18acfc768b9819a4088540bed8a78fd (diff) | |
| download | homebrew-53db7cf17ec0ee3518b91d9fce0183e9f53ab7ee.tar.bz2 | |
Check File.file? first to avoid second stat()
Diffstat (limited to 'Library')
| -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 |
