1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Check Errno::EIO

Catch Errno::EIO what will be occurred if the console terminates I/O before
Reline finishes rendering.

https://github.com/ruby/reline/commit/e51eaa6d43
This commit is contained in:
aycabta 2020-07-04 00:42:06 +09:00
parent f0d3d4fedb
commit 215fe54777
2 changed files with 5 additions and 0 deletions

View file

@ -243,6 +243,8 @@ module Reline
break if line_editor.finished?
end
Reline::IOGate.move_cursor_column(0)
rescue Errno::EIO
# Maybe the I/O has been closed.
rescue StandardError => e
line_editor.finalize
Reline::IOGate.deprep(otio)

View file

@ -67,6 +67,9 @@ class Reline::ANSI
end
c = @@input.raw(intr: true, &:getbyte)
(c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c
rescue Errno::EIO
# Maybe the I/O has been closed.
nil
end
def self.ungetc(c)