diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 10:17:34 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 10:17:34 +0000 |
commit | a112ec787acb1ca84e1a4d6fb5a58f99718c1b1b (patch) | |
tree | 7cfca5fea601bc42cbcc622a1e8b69a5454994f5 /test | |
parent | 2bb4ca64f9a51a9c0830d6cf5c635db73cd00763 (diff) | |
download | ruby-a112ec787acb1ca84e1a4d6fb5a58f99718c1b1b.tar.gz |
* process.c (check_exec_fds): resolve cascaded child fd reference.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_process.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 827dde4844..ea90244655 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -417,21 +417,30 @@ class TestProcess < Test::Unit::TestCase def test_execopts_redirect_dup2_child with_tmpchdir {|d| - Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", STDOUT=>"out", STDERR=>[:child, STDOUT]) + Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", + STDOUT=>"out", STDERR=>[:child, STDOUT]) assert_equal("errout", File.read("out")) - Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", STDERR=>"out", STDOUT=>[:child, STDERR]) + + Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", + STDERR=>"out", STDOUT=>[:child, STDERR]) + assert_equal("errout", File.read("out")) + + Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", + STDOUT=>"out", + STDERR=>[:child, 3], + 3=>[:child, 4], + 4=>[:child, STDOUT] + ) assert_equal("errout", File.read("out")) IO.popen([RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", STDERR=>[:child, STDOUT]]) {|io| assert_equal("errout", io.read) } - assert_raise(ArgumentError) { - Process.wait spawn(*TRUECOMMAND, STDOUT=>[:child, STDOUT]) - } - assert_raise(ArgumentError) { - Process.wait spawn(*TRUECOMMAND, STDOUT=>[:child, 3]) - } + assert_raise(ArgumentError) { Process.wait spawn(*TRUECOMMAND, STDOUT=>[:child, STDOUT]) } + assert_raise(ArgumentError) { Process.wait spawn(*TRUECOMMAND, 3=>[:child, 4], 4=>[:child, 3]) } + assert_raise(ArgumentError) { Process.wait spawn(*TRUECOMMAND, 3=>[:child, 4], 4=>[:child, 5], 5=>[:child, 3]) } + assert_raise(ArgumentError) { Process.wait spawn(*TRUECOMMAND, STDOUT=>[:child, 3]) } } end |