process.c: try conversion at redirection

* io.c (rb_io_check_io): make public.
* process.c (check_exec_redirect): try conversion to IO on redirect
  parameters.  [ruby-core:44181] [Bug #6269]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-07-27 09:25:54 +00:00
parent a8aa1e2127
commit c05e6a8cda
5 changed files with 27 additions and 2 deletions

View file

@ -1,5 +1,5 @@
require 'test/unit'
require 'tmpdir'
require 'tempfile'
require 'pathname'
require 'timeout'
require_relative 'envutil'
@ -806,6 +806,18 @@ class TestProcess < Test::Unit::TestCase
end
end
def test_execopts_redirect_tempfile
bug6269 = '[ruby-core:44181]'
Tempfile.open("execopts") do |tmp|
pid = assert_nothing_raised(ArgumentError, bug6269) do
break spawn(RUBY, "-e", "print $$", out: tmp)
end
Process.wait(pid)
tmp.rewind
assert_equal(pid.to_s, tmp.read)
end
end
def test_execopts_duplex_io
IO.popen("#{RUBY} -e ''", "r+") {|duplex|
assert_raise(ArgumentError) { system("#{RUBY} -e ''", duplex=>STDOUT) }