[ruby/io-console] Avoid the influence of special variable $/
https://github.com/ruby/io-console/commit/5f71354332
This commit is contained in:
parent
cff8058701
commit
818ba30ee9
@ -1564,7 +1564,7 @@ static VALUE
|
||||
str_chomp(VALUE str)
|
||||
{
|
||||
if (!NIL_P(str)) {
|
||||
rb_funcallv(str, id_chomp_bang, 0, 0);
|
||||
rb_funcallv(str, id_chomp_bang, 1, &rb_default_rs);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -258,6 +258,15 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
|
||||
assert_equal("\r\n", r.gets)
|
||||
assert_equal("\"asdf\"", r.gets.chomp)
|
||||
end
|
||||
|
||||
run_pty("$VERBOSE, $/ = nil, '.'; p IO.console.getpass('> ')") do |r, w|
|
||||
assert_equal("> ", r.readpartial(10))
|
||||
sleep 0.1
|
||||
w.print "asdf\n"
|
||||
sleep 0.1
|
||||
assert_equal("\r\n", r.gets)
|
||||
assert_equal("\"asdf\"", r.gets.chomp)
|
||||
end
|
||||
end
|
||||
|
||||
def test_iflush
|
||||
|
Loading…
x
Reference in New Issue
Block a user