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

Commit 8a154c3

Browse files
pirjJonRowe
authored andcommitted
Merge pull request #575 from rspec/sub-process-binary
Prevent warnings about encoding from preventing transfer of errors
1 parent 05a50ed commit 8a154c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/rspec/support/spec/in_sub_process.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def in_sub_process(prevent_warnings=true) # rubocop:disable Metrics/MethodLength
1313
exception_reader, exception_writer = IO.pipe
1414
result_reader, result_writer = IO.pipe
1515

16+
# Set binary mode to avoid errors surrounding ascii-8bit to utf-8 conversion
17+
# this happens with warnings on rspec-rails for example
18+
[exception_reader, exception_writer, result_reader, result_writer].each { |io| io.binmode }
19+
1620
pid = Process.fork do
1721
warning_preventer = $stderr = RSpec::Support::StdErrSplitter.new($stderr)
1822

0 commit comments

Comments
 (0)