[ruby/io-console] Ignore printed control char

It's something we don't expect and might be coming from somewhere
else.

c5e47a900c
This commit is contained in:
Nobuyoshi Nakada 2025-06-27 16:22:56 +09:00 committed by git
parent 495613ffd3
commit 528b75cc14

View file

@ -367,6 +367,15 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
w.print cc
w.flush
result = EnvUtil.timeout(3) {r.gets}
if res
case cc
when 0..31
cc = "^" + (cc.ord | 0x40).chr
when 127
cc = "^?"
end
res.sub!(cc, "")
end
assert_equal(expect, result.chomp)
end