mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Restore the external and internal encodings of STDIN, STDOUT, and STDERR
IRB::ReadlineInputMethod#initialize changes them via IRB.set_encoding.
This commit is contained in:
parent
3b147c4213
commit
1084b679bd
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue