summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-03 15:02:10 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-03 15:02:10 +0000
commit30b8f1ee2be229690c27e61e451c1d6b82e5eeb7 (patch)
treea2a537707ea9382fc976f642e5ab6ce95e9d4c1e /test/ruby/test_process.rb
parent8c01ec883afec88ca496c9f63fd6c98cbc76c5dd (diff)
* process.c (EXEC_OPTION_DUP2_CHILD): defined.
(check_exec_redirect_fd): check :in, :out and :err. (check_exec_redirect): check [:child, fd]. (check_exec_fds): validate EXEC_OPTION_DUP2_CHILD array. (run_exec_dup2_child): new function. (rb_run_exec_options): call run_exec_dup2_child. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index a77773db20..827dde4844 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -415,6 +415,26 @@ class TestProcess < Test::Unit::TestCase
}
end
+ 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])
+ assert_equal("errout", File.read("out"))
+ Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", STDERR=>"out", STDOUT=>[:child, STDERR])
+ 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])
+ }
+ }
+ end
+
def test_execopts_exec
with_tmpchdir {|d|
write_file("s", 'exec "echo aaa", STDOUT=>"foo"')