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

Prevent warnings about encoding from preventing transfer of errors #575

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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