aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-28 21:11:22 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-28 21:11:22 +0000
commite5658a206be8693b4aa006a853b2dd934fb797e0 (patch)
treeaf87f775a6e7b10fdfbd10229c2dd77d740807e7 /io.c
parent2b92335efd4c561ad7a9ad25367838857602e067 (diff)
downloadruby-e5658a206be8693b4aa006a853b2dd934fb797e0.tar.gz
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/io.c b/io.c
index f21b9211b8..3e743f2356 100644
--- a/io.c
+++ b/io.c
@@ -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;