Skip to content

Commit

Permalink
Fix detect a directory as the phantomjs executable
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
jorgemanrubia committed Apr 2, 2014
1 parent 69c1a8c commit 76d1a5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/guard/jasmine/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 76d1a5b

Please sign in to comment.