* eval_error.c (error_print): respect the encoding of the message.

* io.c (rb_write_error_str): use rb_w32_write_console() on Windows
  if stderr is a tty.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2014-11-28 21:11:22 +00:00
parent 2b92335efd
commit e5658a206b
3 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Sat Nov 29 06:09:44 2014 NAKAMURA Usaku <usa@ruby-lang.org>
* eval_error.c (error_print): respect the encoding of the message.
* io.c (rb_write_error_str): use rb_w32_write_console() on Windows
if stderr is a tty.
Fri Nov 28 05:10:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (--with-setup): add option to select ext/Setup file.

View File

@ -162,14 +162,14 @@ error_print(void)
tail++; /* skip newline */
}
warn_print(": ");
warn_print2(einfo, len);
warn_print_str(tail ? rb_str_subseq(e, 0, len) : e);
if (epath) {
warn_print(" (");
warn_print_str(epath);
warn_print(")\n");
}
if (tail) {
warn_print2(tail, elen - len - 1);
warn_print_str(rb_str_substr(e, tail - einfo, elen - len - 1));
}
if (tail ? einfo[elen-1] != '\n' : !epath) warn_print2("\n", 1);
}

5
io.c
View File

@ -7260,6 +7260,11 @@ rb_write_error_str(VALUE mesg)
/* a stopgap measure for the time being */
if (rb_stderr == orig_stderr || RFILE(orig_stderr)->fptr->fd < 0) {
size_t len = (size_t)RSTRING_LEN(mesg);
#ifdef _WIN32
if (isatty(fileno(stderr))) {
if (rb_w32_write_console(mesg, fileno(stderr)) > 0) return;
}
#endif
if (fwrite(RSTRING_PTR(mesg), sizeof(char), len, stderr) < len) {
RB_GC_GUARD(mesg);
return;