summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-25 15:50:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-25 15:50:24 +0000
commitb4ab5272980bc0a81575790fee20585b6f205938 (patch)
tree1d6638ff57c908d341a2dc0b35ca4b154d7fe129 /test/ruby
parenta0681d3b1e5a25f5ad627e8a932032cd2ecc0d8a (diff)
downloadruby-b4ab5272980bc0a81575790fee20585b6f205938.tar.gz
ruby-b4ab5272980bc0a81575790fee20585b6f205938.tar.xz
ruby-b4ab5272980bc0a81575790fee20585b6f205938.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@16195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_process.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index d8113d718..e68f1070e 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}") }
@@ -465,6 +465,11 @@ class TestProcess < Test::Unit::TestCase
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
assert_equal("", r.read)