diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-06 06:30:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-06 06:30:11 +0000 |
commit | 1ad0d8ecad01eb4d8fface25db59db16929974a4 (patch) | |
tree | f61c3507e9b90e2326dd28c1b6a59d62526d0868 /ext/io/console/console.c | |
parent | 187de9240a82462c34ab26e1851c2f60182546e7 (diff) |
console.c: prompt to stderr
* ext/io/console/console.c (console_getpass): print prompt to
stderr when reading from stdin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io/console/console.c')
-rw-r--r-- | ext/io/console/console.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 629a7fbd6d..50a2975bf8 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -857,14 +857,6 @@ getpass_call(VALUE io) 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, VALUE io) 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); |