[ruby/io-console] Ensure to put a newline after password

https://github.com/ruby/io-console/commit/15e36af171
This commit is contained in:
Nobuyoshi Nakada 2023-08-18 11:46:04 +09:00 committed by git
parent 528da4347c
commit cff8058701

View File

@ -1538,6 +1538,12 @@ puts_call(VALUE io)
return rb_io_write(io, rb_default_rs);
}
static VALUE
gets_call(VALUE io)
{
return rb_funcallv(io, id_gets, 0, 0);
}
static VALUE
getpass_call(VALUE io)
{
@ -1610,9 +1616,8 @@ io_getpass(int argc, VALUE *argv, VALUE io)
rb_check_arity(argc, 0, 1);
prompt(argc, argv, io);
rb_check_funcall(io, id_flush, 0, 0);
str = str_chomp(rb_funcallv(io, id_gets, 0, 0));
puts_call(io);
return str;
str = rb_ensure(gets_call, io, puts_call, io);
return str_chomp(str);
}
/*