From fe9b92f14902e9a7521d1da8467ec9d932a5ce65 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 25 Apr 2008 15:50:24 +0000 Subject: * process.c (rb_spawn_internal): new function to specify default_close_others. (rb_spawn): specify default_close_others true. (rb_f_system): call rb_spawn_internal with default_close_others as false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index d8113d7180..e68f1070e6 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -419,9 +419,9 @@ class TestProcess < Test::Unit::TestCase assert_equal("ba\n", r.read) } with_pipe {|r, w| - Process.wait spawn("echo bi >&#{w.fileno}") + Process.wait spawn("exec 2>/dev/null; echo bi >&#{w.fileno}") w.close - assert_equal("bi\n", r.read) + assert_equal("", r.read) } with_pipe {|r, w| Process.wait fork { exec("echo bu >&#{w.fileno}") } @@ -464,6 +464,11 @@ class TestProcess < Test::Unit::TestCase assert_equal("", r.read) File.unlink("err") } + with_pipe {|r, w| + Process.wait spawn("echo bi >&#{w.fileno}", :close_others=>false) + w.close + assert_equal("bi\n", r.read) + } with_pipe {|r, w| Process.wait fork { exec("exec >/dev/null 2>err; echo mu >&#{w.fileno}", :close_others=>true) } w.close -- cgit v1.2.3