Skip to content

Commit

Permalink
Merge pull request #364 from ngan/fix-encoding-for-rails-apps
Browse files Browse the repository at this point in the history
Set encoding for write pipe
  • Loading branch information
casperisfine committed Jul 26, 2021
2 parents ba68d31 + c6ecffc commit 6c89cf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,7 @@
# Unreleased

* Fix `Encoding::UndefinedConversionError` error for Rails applications when precompiling cache. (#364)

# 1.7.5

* Handle a regression of Ruby 2.7.3 causing Bootsnap to call the deprecated `untaint` method. (#360)
Expand Down
6 changes: 5 additions & 1 deletion lib/bootsnap/cli/worker_pool.rb
Expand Up @@ -37,7 +37,11 @@ class Worker

def initialize(jobs)
@jobs = jobs
@pipe_out, @to_io = IO.pipe
@pipe_out, @to_io = IO.pipe(binmode: true)
# Set the writer encoding to binary since IO.pipe only sets it for the reader.
# https://github.com/rails/rails/issues/16514#issuecomment-52313290
@to_io.set_encoding(Encoding::BINARY)

@pid = nil
end

Expand Down

0 comments on commit 6c89cf9

Please sign in to comment.