[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
Родитель f0d3d4fedb
Коммит 215fe54777
2 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)