diff options
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 6990de1862..cd4fe98981 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1457,9 +1457,11 @@ class TestIO < Test::Unit::TestCase def try_fdopen(fd, autoclose = true, level = 100) if level > 0 - f = try_fdopen(fd, autoclose, level - 1) - GC.start - f + begin + 1.times {return try_fdopen(fd, autoclose, level - 1)} + ensure + GC.start + end else WeakRef.new(IO.for_fd(fd, autoclose: autoclose)) end |