Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #575 from rspec/sub-process-binary
Browse files Browse the repository at this point in the history
Prevent warnings about encoding from preventing transfer of errors
  • Loading branch information
pirj authored and JonRowe committed Feb 4, 2024
1 parent 05a50ed commit 8a154c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rspec/support/spec/in_sub_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def in_sub_process(prevent_warnings=true) # rubocop:disable Metrics/MethodLength
exception_reader, exception_writer = IO.pipe
result_reader, result_writer = IO.pipe

# Set binary mode to avoid errors surrounding ascii-8bit to utf-8 conversion
# this happens with warnings on rspec-rails for example
[exception_reader, exception_writer, result_reader, result_writer].each { |io| io.binmode }

pid = Process.fork do
warning_preventer = $stderr = RSpec::Support::StdErrSplitter.new($stderr)

Expand Down

0 comments on commit 8a154c3

Please sign in to comment.