about summary refs log tree commit homepage
path: root/test/test_unix_connect.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-16 18:37:37 -0800
committerEric Wong <normalperson@yhbt.net>2011-11-17 17:58:06 -0800
commitbe3672501ecde716dae723e887d4a9e4d731240c (patch)
tree07c6fc18258a4adecf51deb7e2136d81892cac08 /test/test_unix_connect.rb
parent48dc3c5a1943801311567e72a8e69fcb0cd8cf8d (diff)
downloadkgio-be3672501ecde716dae723e887d4a9e4d731240c.tar.gz
All IO objects created by Kgio will have FD_CLOEXEC descriptor
flag set on it when run under Ruby 2.0.0dev.  This matches the
upcoming behavior of Ruby 2.0.0dev for IO objects in the core
and standard library.  This change does not affect users on Ruby
1.9.3 and earlier.

accept()-ed sockets in kgio have _always_ had FD_CLOEXEC
set by default.
Diffstat (limited to 'test/test_unix_connect.rb')
-rw-r--r--test/test_unix_connect.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_unix_connect.rb b/test/test_unix_connect.rb
index f99a877..b85f1f6 100644
--- a/test/test_unix_connect.rb
+++ b/test/test_unix_connect.rb
@@ -34,6 +34,10 @@ class TestKgioUnixConnect < Test::Unit::TestCase
 
   def test_unix_socket_new
     sock = Kgio::UNIXSocket.new(@path)
+
+    sock.respond_to?(:close_on_exec?) and
+      assert_equal(RUBY_VERSION.to_f >= 2.0, sock.close_on_exec?)
+
     assert_instance_of Kgio::UNIXSocket, sock
     ready = IO.select(nil, [ sock ])
     assert_equal sock, ready[1][0]
@@ -42,6 +46,10 @@ class TestKgioUnixConnect < Test::Unit::TestCase
 
   def test_new
     sock = Kgio::Socket.new(@addr)
+
+    sock.respond_to?(:close_on_exec?) and
+      assert_equal(RUBY_VERSION.to_f >= 2.0, sock.close_on_exec?)
+
     assert_instance_of Kgio::Socket, sock
     ready = IO.select(nil, [ sock ])
     assert_equal sock, ready[1][0]