aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb23
1 files changed, 7 insertions, 16 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 35f575aa13..a82cac239b 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -578,18 +578,6 @@ class TestIO < Test::Unit::TestCase
(wt.kill; wt.join) if wt
end
- def pipe2(&b)
- a = []
- a << IO.pipe while true
- rescue Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM
- yield(*a.last)
- ensure
- a.each do |r, w|
- r.close unless !r || r.closed?
- w.close unless !w || w.closed?
- end
- end
-
def ruby(*args)
args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin
@@ -640,10 +628,13 @@ class TestIO < Test::Unit::TestCase
open(__FILE__) # see Bug #493 [ruby-dev:35957]
end.call
- pipe2 do |r, w|
- assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do
- r2, w2 = r.dup, w.dup
- end
+ a = []
+ assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do
+ loop {a << IO.pipe}
+ end
+ a.each do |r, w|
+ r.close unless !r || r.closed?
+ w.close unless !w || w.closed?
end
end