[前][次][番号順一覧][スレッド一覧]

ruby-changes:61045

From: Yusuke <ko1@a...>
Date: Fri, 8 May 2020 00:20:43 +0900 (JST)
Subject: [ruby-changes:61045] 1084b679bd (master): Restore the external and internal encodings of STDIN, STDOUT, and STDERR

https://git.ruby-lang.org/ruby.git/commit/?id=1084b679bd

From 1084b679bd793b98ee75cb8b2bbbc664998f041f Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
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.

diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index dd24c1e..897828e 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -18,6 +18,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L18
       @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 https://github.com/ruby/ruby/blob/trunk/test/irb/test_cmd.rb#L28
       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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]