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

ruby-changes:44496

From: nagachika <ko1@a...>
Date: Sat, 5 Nov 2016 12:01:36 +0900 (JST)
Subject: [ruby-changes:44496] nagachika:r56569 (ruby_2_3): merge revision(s) 56416: [Backport #12836]

nagachika	2016-11-05 12:01:30 +0900 (Sat, 05 Nov 2016)

  New Revision: 56569

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56569

  Log:
    merge revision(s) 56416: [Backport #12836]
    
    * io.c (copy_stream_body): use IO to write to copy to duplex IO.
      http://twitter.com/knu/status/786505317974585344

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/io.c
    branches/ruby_2_3/test/ruby/test_io.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/test/ruby/test_io.rb
===================================================================
--- ruby_2_3/test/ruby/test_io.rb	(revision 56568)
+++ ruby_2_3/test/ruby/test_io.rb	(revision 56569)
@@ -1090,6 +1090,18 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_io.rb#L1090
     }
   end
 
+  def test_copy_stream_to_duplex_io
+    result = IO.pipe {|a,w|
+      Thread.start {w.puts "yes"; w.close}
+      IO.popen([EnvUtil.rubybin, '-pe$_="#$.:#$_"'], "r+") {|b|
+        IO.copy_stream(a, b)
+        b.close_write
+        b.read
+      }
+    }
+    assert_equal("1:yes\n", result)
+  end
+
   def ruby(*args)
     args = ['-e', '$>.write($<.read)'] if args.empty?
     ruby = EnvUtil.rubybin
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56568)
+++ ruby_2_3/version.h	(revision 56569)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
 #define RUBY_RELEASE_DATE "2016-11-05"
-#define RUBY_PATCHLEVEL 204
+#define RUBY_PATCHLEVEL 205
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 11
Index: ruby_2_3/io.c
===================================================================
--- ruby_2_3/io.c	(revision 56568)
+++ ruby_2_3/io.c	(revision 56569)
@@ -10619,7 +10619,7 @@ copy_stream_body(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/io.c#L10619
     else {
 	VALUE tmp_io = rb_io_check_io(dst_io);
 	if (!NIL_P(tmp_io)) {
-	    dst_io = tmp_io;
+	    dst_io = GetWriteIO(tmp_io);
 	}
 	else if (!RB_TYPE_P(dst_io, T_FILE)) {
 	    VALUE args[3];
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 56568)
+++ ruby_2_3/ChangeLog	(revision 56569)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sat Nov  5 11:53:17 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (copy_stream_body): use IO to write to copy to duplex IO.
+	  http://twitter.com/knu/status/786505317974585344
+
 Sat Nov  5 11:49:41 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* sprintf.c (rb_str_format): format exact number more exactly.

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56416


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

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