From 1084b679bd793b98ee75cb8b2bbbc664998f041f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 8 May 2020 00:19:54 +0900 Subject: Restore the external and internal encodings of STDIN, STDOUT, and STDERR IRB::ReadlineInputMethod#initialize changes them via IRB.set_encoding. --- test/irb/test_cmd.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/irb') diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index dd24c1e4fc..897828ee2e 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -18,6 +18,7 @@ module TestIRB @home_backup = ENV["HOME"] ENV["HOME"] = @tmpdir @default_encoding = [Encoding.default_external, Encoding.default_internal] + @stdio_encodings = [STDIN, STDOUT, STDERR].map {|io| [io.external_encoding, io.internal_encoding] } IRB.instance_variable_get(:@CONF).clear end @@ -27,6 +28,9 @@ module TestIRB FileUtils.rm_rf(@tmpdir) EnvUtil.suppress_warning { Encoding.default_external, Encoding.default_internal = *@default_encoding + [STDIN, STDOUT, STDERR].zip(@stdio_encodings) do |io, encs| + io.set_encoding(*encs) + end } end -- cgit v1.2.3