зеркало из https://github.com/github/ruby.git
io.c: open generic in binread
* io.c (rb_io_s_binread): fix r61317, unintentional change. From: Nobuyoshi Nakada <nobu@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c740951f25
Коммит
6b718de1d6
2
io.c
2
io.c
|
@ -10420,7 +10420,7 @@ rb_io_s_binread(int argc, VALUE *argv, VALUE io)
|
|||
rb_scan_args(argc, argv, "12", NULL, NULL, &offset);
|
||||
FilePathValue(argv[0]);
|
||||
convconfig.enc = rb_ascii8bit_encoding();
|
||||
arg.io = rb_file_open_generic(io_alloc(io), argv[0], oflags, fmode, &convconfig, 0);
|
||||
arg.io = rb_io_open_generic(io, argv[0], oflags, fmode, &convconfig, 0);
|
||||
if (NIL_P(arg.io)) return Qnil;
|
||||
arg.argv = argv+1;
|
||||
arg.argc = (argc > 1) ? 1 : 0;
|
||||
|
|
|
@ -2188,9 +2188,15 @@ class TestIO < Test::Unit::TestCase
|
|||
assert_warn(/invoke external command/) do
|
||||
File.read("|#{EnvUtil.rubybin} -e puts")
|
||||
end
|
||||
assert_warn(/invoke external command/) do
|
||||
File.binread("|#{EnvUtil.rubybin} -e puts")
|
||||
end
|
||||
assert_raise_with_message(ArgumentError, /invoke external command/) do
|
||||
Class.new(IO).read("|#{EnvUtil.rubybin} -e puts")
|
||||
end
|
||||
assert_raise_with_message(ArgumentError, /invoke external command/) do
|
||||
Class.new(IO).binread("|#{EnvUtil.rubybin} -e puts")
|
||||
end
|
||||
end
|
||||
|
||||
def test_reopen
|
||||
|
|
Загрузка…
Ссылка в новой задаче