diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-05 13:37:09 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-05 13:37:09 +0000 |
commit | 7a69a3583c2235c0ad3ad0705aa2f08cbe2d76bb (patch) | |
tree | 25c6c82a0c18f7c08c7d2e101a69901c0ab24702 /test/ruby | |
parent | edacb3a94ac275a62451f49bb2f70e9c1fc6619b (diff) | |
download | ruby-7a69a3583c2235c0ad3ad0705aa2f08cbe2d76bb.tar.gz |
* process.c (check_exec_redirect): Open the file in write mode for
redirect from [:out, :err].
Proposed and implemented by Yusuke Endoh.
[ruby-dev:41430] [Feature #3348]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_process.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 0fe687fcb7..94fda02ebb 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -613,6 +613,17 @@ class TestProcess < Test::Unit::TestCase } end + def test_execopts_redirect_to_out_and_err + with_tmpchdir {|d| + ret = system(RUBY, "-e", 'STDERR.print "e"; STDOUT.print "o"', [:out, :err] => "foo") + assert_equal(true, ret) + assert_equal("eo", File.read("foo")) + ret = system(RUBY, "-e", 'STDERR.print "E"; STDOUT.print "O"', [:err, :out] => "bar") + assert_equal(true, ret) + assert_equal("EO", File.read("bar")) + } + end + def test_execopts_redirect_dup2_child with_tmpchdir {|d| Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", |