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:
parent
f0d3d4fedb
commit
215fe54777
2 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue