ruby-changes:40824
From: nobu <ko1@a...>
Date: Sun, 6 Dec 2015 15:30:28 +0900 (JST)
Subject: [ruby-changes:40824] nobu:r52903 (trunk): console.c: prompt to stderr
nobu 2015-12-06 15:30:11 +0900 (Sun, 06 Dec 2015) New Revision: 52903 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52903 Log: console.c: prompt to stderr * ext/io/console/console.c (console_getpass): print prompt to stderr when reading from stdin. Modified files: trunk/ext/io/console/console.c Index: ext/io/console/console.c =================================================================== --- ext/io/console/console.c (revision 52902) +++ ext/io/console/console.c (revision 52903) @@ -857,14 +857,6 @@ getpass_call(VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L857 return ttymode(io, rb_io_gets, set_noecho, NULL); } -static VALUE -write_io(VALUE io) -{ - VALUE wio = rb_io_get_write_io(io); - if (wio == io && io == rb_stdin) wio = rb_stdout; - return wio; -} - static void prompt(int argc, VALUE *argv, VALUE io) { @@ -900,7 +892,8 @@ console_getpass(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L892 VALUE str, wio; rb_check_arity(argc, 0, 1); - wio = write_io(io); + wio = rb_io_get_write_io(io); + if (wio == io && io == rb_stdin) wio = rb_stderr; prompt(argc, argv, wio); str = rb_ensure(getpass_call, io, puts_call, wio); return str_chomp(str); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/