Skip to content

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 Apr 18, 2023
2 parents f5cf0d5 + 8f165d8 commit 6d33eaa
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 @@ -11,6 +11,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 6d33eaa

Please sign in to comment.