summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lib/test/unit.rb2
-rw-r--r--test/ruby/test_process.rb9
2 files changed, 11 insertions, 0 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index 51c8960c52..7a09466d1c 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -145,6 +145,8 @@ module Test
r.close if r
nil
else
+ r.close_on_exec = true
+ w.close_on_exec = true
@jobserver = [r, w]
options[:parallel] ||= 1
end
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index a0b08dd110..bb56834dc0 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1009,6 +1009,15 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_close_others_default_false
+ IO.pipe do |r,w|
+ w.close_on_exec = false
+ src = "IO.new(#{w.fileno}).puts(:hi)"
+ assert_equal true, system(*%W(#{RUBY} --disable=gems -e #{src}))
+ assert_equal "hi\n", r.gets
+ end
+ end
+
def test_execopts_redirect_self
begin
with_pipe {|r, w|