diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-05-08 00:19:54 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-05-08 00:19:54 +0900 |
commit | 1084b679bd793b98ee75cb8b2bbbc664998f041f (patch) | |
tree | ee803c00500f59dc8c5cfd4a8a050b2981b5e6d3 /test/irb | |
parent | 3b147c421368825ab3ff69dd78d10d7f7db0765e (diff) |
Restore the external and internal encodings of STDIN, STDOUT, and STDERR
IRB::ReadlineInputMethod#initialize changes them via IRB.set_encoding.
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_cmd.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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 |