Skip to content

Commit

Permalink
Use Bundler's .which method instead of the shell for finding wkhtmltopdf
Browse files Browse the repository at this point in the history
Using the shell to get this information leads to the risk of capturing
warning information from bundler. Using the which method (which has been
around for years) will do the same thing, but will only return the path
and nothing else.
  • Loading branch information
Matthew Crocco committed Mar 16, 2018
1 parent ee065e4 commit 7768be7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/wicked_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def find_wkhtmltopdf_binary_path
possible_locations += %w[~/bin] if ENV.key?('HOME')
exe_path ||= WickedPdf.config[:exe_path] unless WickedPdf.config.empty?
exe_path ||= begin
detected_path = (defined?(Bundler) ? `bundle exec which wkhtmltopdf` : `which wkhtmltopdf`).chomp
detected_path = (defined?(Bundler) ? Bundler.which('wkhtmltopdf') : `which wkhtmltopdf`).chomp
detected_path.present? && detected_path
rescue StandardError
nil
Expand Down

0 comments on commit 7768be7

Please sign in to comment.