From 36cb003300b53d47b7a8e28e3a870d85fd2b3999 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 30 Apr 2008 05:40:19 +0000 Subject: * process.c (check_exec_redirect_fd): prohibit duplex IO. (check_exec_fds): record maxhint even if close_others is not specified. (rb_exec_arg_fixup): renamed from rb_exec_arg_fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ruby/test_process.rb') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 16340f9c3f..7a37723f36 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -523,6 +523,24 @@ class TestProcess < Test::Unit::TestCase } end + def test_execopts_redirect_self + with_pipe {|r, w| + w << "haha\n" + w.close + r.close_on_exec = true + IO.popen([RUBY, "-e", "print IO.new(#{r.fileno}).read", r.fileno=>r.fileno, :close_others=>false]) {|io| + assert_equal("haha\n", io.read) + } + } + end + + def test_execopts_duplex_io + IO.popen("#{RUBY} -e ''", "r+") {|duplex| + assert_raise(ArgumentError) { system("#{RUBY} -e ''", duplex=>STDOUT) } + assert_raise(ArgumentError) { system("#{RUBY} -e ''", STDOUT=>duplex) } + } + end + def test_execopts_modification h = {} Process.wait spawn(*TRUECOMMAND, h) -- cgit v1.2.3