mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[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:
parent
495613ffd3
commit
528b75cc14
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue