From 76d1a5bed858657f8320bfbfba0f68ac0f1c9a2d Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Wed, 2 Apr 2014 14:10:23 +0200 Subject: [PATCH] Fix detect a directory as the phantomjs executable `File.executable?(exe)` will return `true` for directories. This patch ensures that only files are selected. With the existing code, it can detect a directory named `phantomjs` as the phantomjs executable. This was exactly what was happening in my case: Sencha Cmd tool creates a "phantomjs" directory which is reachable from the path, and this was making guard-jasmine fail. --- lib/guard/jasmine/util.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guard/jasmine/util.rb b/lib/guard/jasmine/util.rb index ca16540..e0a38a6 100644 --- a/lib/guard/jasmine/util.rb +++ b/lib/guard/jasmine/util.rb @@ -110,7 +110,7 @@ def which(cmd) ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = "#{ path }/#{ cmd }#{ ext }" - return exe if File.executable?(exe) + return exe if File.file?(exe) && File.executable?(exe) end end