[前][次][番号順一覧][スレッド一覧]

ruby-changes:36556

From: usa <ko1@a...>
Date: Sat, 29 Nov 2014 06:11:47 +0900 (JST)
Subject: [ruby-changes:36556] usa:r48637 (trunk): * eval_error.c (error_print): respect the encoding of the message.

usa	2014-11-29 06:11:22 +0900 (Sat, 29 Nov 2014)

  New Revision: 48637

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48637

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/eval_error.c
    trunk/io.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48636)
+++ ChangeLog	(revision 48637)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov 29 06:09:44 2014  NAKAMURA Usaku  <usa@r...>
+
+	* 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@r...>
 
 	* configure.in (--with-setup): add option to select ext/Setup file.
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 48636)
+++ eval_error.c	(revision 48637)
@@ -162,14 +162,14 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L162
 		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);
 	}
Index: io.c
===================================================================
--- io.c	(revision 48636)
+++ io.c	(revision 48637)
@@ -7260,6 +7260,11 @@ rb_write_error_str(VALUE mesg) https://github.com/ruby/ruby/blob/trunk/io.c#L7260
     /* 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]