summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-30 05:40:19 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-30 05:40:19 +0000
commit36cb003300b53d47b7a8e28e3a870d85fd2b3999 (patch)
treee39680b86c1d948fd525eb78bdf3e1e9a2615f7d /test
parent01e712d78685d17654cbf87d9aefeff75de87e4f (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb18
1 files changed, 18 insertions, 0 deletions
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)