mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
01e712d786
commit
36cb003300
5 changed files with 36 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue