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

ruby-changes:62252

From: Nobuyoshi <ko1@a...>
Date: Wed, 15 Jul 2020 16:37:21 +0900 (JST)
Subject: [ruby-changes:62252] 79d06483a8 (master): Close sockets if blocking to fix leaked fds

https://git.ruby-lang.org/ruby.git/commit/?id=79d06483a8

From 79d06483a8ac98a87e5c32d3a34823382a72a0da Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 15 Jul 2020 16:36:57 +0900
Subject: Close sockets if blocking to fix leaked fds


diff --git a/test/fiber/test_enumerator.rb b/test/fiber/test_enumerator.rb
index 6679d9e..d332726 100644
--- a/test/fiber/test_enumerator.rb
+++ b/test/fiber/test_enumerator.rb
@@ -10,7 +10,11 @@ class TestFiberEnumerator < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fiber/test_enumerator.rb#L10
     skip unless defined?(UNIXSocket)
 
     i, o = UNIXSocket.pair
-    skip unless i.nonblock? && o.nonblock?
+    unless i.nonblock? && o.nonblock?
+      i.close
+      o.close
+      skip
+    end
 
     message = String.new
 
@@ -41,5 +45,7 @@ class TestFiberEnumerator < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fiber/test_enumerator.rb#L45
     thread.join
 
     assert_equal(MESSAGE, message)
+    assert_predicate(i, :closed?)
+    assert_predicate(o, :closed?)
   end
 end
-- 
cgit v0.10.2


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

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