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

ruby-changes:46173

From: nobu <ko1@a...>
Date: Sun, 9 Apr 2017 14:09:50 +0900 (JST)
Subject: [ruby-changes:46173] nobu:r58286 (trunk): thread.c: refine stream closed message

nobu	2017-04-09 14:09:44 +0900 (Sun, 09 Apr 2017)

  New Revision: 58286

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

  Log:
    thread.c: refine stream closed message
    
    * thread.c (Init_Thread): [EXPERIMENTAL] refine the "stream
      closed" special exception message, by explicating that it is
      caused by threading.  [ruby-core:80583] [Bug #13405]

  Modified files:
    trunk/NEWS
    trunk/test/lib/test/unit/parallel.rb
    trunk/test/lib/test/unit.rb
    trunk/thread.c
Index: NEWS
===================================================================
--- NEWS	(revision 58285)
+++ NEWS	(revision 58286)
@@ -34,6 +34,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L34
   * IO#pread  [Feature #4532]
   * IO#pwrite  [Feature #4532]
 
+* IOError
+
+  * exception message "stream closed" is changed  [Bug #13405]
+
 * Regexp
   * Update Onigmo 6.1.1.
     * Support absent operator https://github.com/k-takata/Onigmo/issues/82
Index: test/lib/test/unit/parallel.rb
===================================================================
--- test/lib/test/unit/parallel.rb	(revision 58285)
+++ test/lib/test/unit/parallel.rb	(revision 58286)
@@ -61,7 +61,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit/parallel.rb#L61
         begin
           th.join
         rescue IOError
-          raise unless ["stream closed","closed stream"].include? $!.message
+          raise unless /stream closed|closed stream/ =~ $!.message
         end
         i.close
 
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 58285)
+++ test/lib/test/unit.rb	(revision 58286)
@@ -225,7 +225,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L225
           rescue Errno::EPIPE
             died
           rescue IOError
-            raise unless ["stream closed","closed stream"].include? $!.message
+            raise unless /stream closed|closed stream/ =~ $!.message
             died
           end
         end
Index: thread.c
===================================================================
--- thread.c	(revision 58285)
+++ thread.c	(revision 58286)
@@ -4881,7 +4881,8 @@ Init_Thread(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L4881
     rb_define_method(rb_cThread, "name=", rb_thread_setname, 1);
     rb_define_method(rb_cThread, "inspect", rb_thread_inspect, 0);
 
-    rb_vm_register_special_exception(ruby_error_stream_closed, rb_eIOError, "stream closed");
+    rb_vm_register_special_exception(ruby_error_stream_closed, rb_eIOError,
+				     "stream closed in another thread");
 
     cThGroup = rb_define_class("ThreadGroup", rb_cObject);
     rb_define_alloc_func(cThGroup, thgroup_s_alloc);

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

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