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

ruby-changes:54953

From: ko1 <ko1@a...>
Date: Sun, 3 Mar 2019 09:17:23 +0900 (JST)
Subject: [ruby-changes:54953] ko1:r67159 (trunk): close opened files explicitly

ko1	2019-03-03 09:17:18 +0900 (Sun, 03 Mar 2019)

  New Revision: 67159

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

  Log:
    close opened files explicitly
    to fix a test failure like
    http://ci.rvm.jp/results/trunk-theap-asserts@silicon-docker/1804207

  Modified files:
    trunk/test/ruby/test_dir.rb
Index: test/ruby/test_dir.rb
===================================================================
--- test/ruby/test_dir.rb	(revision 67158)
+++ test/ruby/test_dir.rb	(revision 67159)
@@ -457,8 +457,11 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_dir.rb#L457
     begin;
       Process.setrlimit(Process::RLIMIT_NOFILE, 50)
       begin
-        tap {tap {tap {(0..100).map {open(IO::NULL)}}}}
+        fs = []
+        tap {tap {tap {(0..100).map {fs << open(IO::NULL)}}}}
       rescue Errno::EMFILE
+      ensure
+        fs.each{|f| f.close}
       end
       list = Dir.glob("*").sort
       assert_not_empty(list)

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

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