From 7bd4f76b8ca090e3dd266e68e0a7fe1b1c41277b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 6 Jul 2014 13:35:44 -0500 Subject: Check File.file? first to avoid second stat() --- Library/Homebrew/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library') 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 -- cgit v1.2.3