ruby-changes:16434
From: yugui <ko1@a...>
Date: Thu, 24 Jun 2010 11:00:45 +0900 (JST)
Subject: [ruby-changes:16434] Ruby:r28419 (ruby_1_9_2): merges r28330 from trunk into ruby_1_9_2.
yugui 2010-06-24 11:00:15 +0900 (Thu, 24 Jun 2010) New Revision: 28419 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28419 Log: merges r28330 from trunk into ruby_1_9_2. -- * test/ruby/test_io.rb (safe_4): does not use Timeout because Timeout.timeout uses Thread#kill which raises SecurityError when $SAFE == 4. based on a patch from Tomoyuki Chikanaga. [ruby-dev:41484] * test/ruby/test_io.rb (test_print_separators): use pipe (test helper method) instead of IO.pipe. [ruby-dev:41484] Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/test/ruby/test_io.rb Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 28418) +++ ruby_1_9_2/ChangeLog (revision 28419) @@ -1,3 +1,13 @@ +Wed Jun 16 00:04:38 2010 Yusuke Endoh <mame@t...> + + * test/ruby/test_io.rb (safe_4): does not use Timeout because + Timeout.timeout uses Thread#kill which raises SecurityError when + $SAFE == 4. based on a patch from Tomoyuki Chikanaga. + [ruby-dev:41484] + + * test/ruby/test_io.rb (test_print_separators): use pipe (test helper + method) instead of IO.pipe. [ruby-dev:41484] + Mon Jun 14 04:03:55 2010 NARUSE, Yui <naruse@r...> * ext/fiddle/closure.c (dealloc): refix workaround r28300. Index: ruby_1_9_2/test/ruby/test_io.rb =================================================================== --- ruby_1_9_2/test/ruby/test_io.rb (revision 28418) +++ ruby_1_9_2/test/ruby/test_io.rb (revision 28419) @@ -740,12 +740,14 @@ end def safe_4 - Thread.new do - Timeout.timeout(10) do - $SAFE = 4 - yield - end - end.join + t = Thread.new do + $SAFE = 4 + yield + end + unless t.join(10) + t.kill + flunk("timeout in safe_4") + end end def pipe(wp, rp) @@ -1461,15 +1463,16 @@ def test_print_separators $, = ':' $\ = "\n" - r, w = IO.pipe - w.print('a') - w.print('a','b','c') - w.close - assert_equal("a\n", r.gets) - assert_equal("a:b:c\n", r.gets) - assert_nil r.gets - r.close - + pipe(proc do |w| + w.print('a') + w.print('a','b','c') + w.close + end, proc do |r| + assert_equal("a\n", r.gets) + assert_equal("a:b:c\n", r.gets) + assert_nil r.gets + r.close + end) ensure $, = nil $\ = nil -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/