Skip to content

Commit

Permalink
Close sockets if blocking to fix leaked fds
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jul 15, 2020
1 parent 5783d0d commit 79d0648
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/fiber/test_enumerator.rb
Expand Up @@ -10,7 +10,11 @@ def test_read_characters
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

Expand Down Expand Up @@ -41,5 +45,7 @@ def test_read_characters
thread.join

assert_equal(MESSAGE, message)
assert_predicate(i, :closed?)
assert_predicate(o, :closed?)
end
end

0 comments on commit 79d0648

Please sign in to comment.