Skip to content

Commit

Permalink
Version check hangs on ruby 3 with certain gem combination
Browse files Browse the repository at this point in the history
Close unneeded pipes when wkhtmltopdf checking version.

Unless we close the stdin and stderr pipes in Open3, this command will hang when running under Ruby 3.1 (and possibly ruby 3.0 too).

According to [the documentation](https://docs.ruby-lang.org/en/2.0.0/Open3.html#method-i-popen3) these pipes should be closed explicitly when in block form (like we are using).

Note: This only happens for me when I'm also using a bunch of older/outdated gems (specifically, `eye`, which uses `celluloid`, `celluloid-io`, `kostya-sigar` and `state_machines` gems). If I'm not including these gems (via `ey`) in my project, this problem doesn't occur
  • Loading branch information
rdunlop authored Nov 4, 2024
1 parent 5a4c76a commit 5dc8a89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/wicked_pdf/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def xvfb_run_path
private

def retrieve_binary_version
_stdin, stdout, _stderr = Open3.popen3(@path + ' -V')
stdin, stdout, stderr = Open3.popen3(@path + ' -V')
stdin.close
stderr.close
parse_version_string(stdout.gets(nil))
rescue StandardError
default_version
Expand Down

0 comments on commit 5dc8a89

Please sign in to comment.