зеркало из https://github.com/github/ruby.git
* io.c (set_stdio): better message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2046e06513
Коммит
c92a8f21a6
|
@ -1,3 +1,7 @@
|
|||
Thu May 15 13:26:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (set_stdio): better message.
|
||||
|
||||
Thu May 15 13:18:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (set_stdio): $stdin, $stdout, $stderr now became read-only.
|
||||
|
|
17
io.c
17
io.c
|
@ -2767,8 +2767,21 @@ set_stdio(val, id, var)
|
|||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
rb_warn("assignment to %s is deprecated; use STDIN.reopen() instead", rb_id2name(id));
|
||||
rb_name_error(id, "%s is a read-only variable", rb_id2name(id));
|
||||
char *vn = rb_id2name(id);
|
||||
char *cn = "IO#";
|
||||
|
||||
if (strlen(vn) > 5) {
|
||||
switch (vn[4]) {
|
||||
case 'i':
|
||||
cn = "STDIN."; break;
|
||||
case 'o':
|
||||
cn = "STDOUT."; break;
|
||||
case 'e':
|
||||
cn = "STDERR."; break;
|
||||
}
|
||||
}
|
||||
rb_warn("assignment to %s is deprecated; use %sreopen() instead", vn, cn);
|
||||
rb_name_error(id, "%s is a read-only variable", vn);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче