diff options
author | aycabta <aycabta@gmail.com> | 2020-07-04 00:42:06 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-08-18 19:04:31 +0900 |
commit | 215fe54777c7183198d9789b25ea0e0af016261b (patch) | |
tree | 33fb50e4f651ad0e524ea7331243f2d61bba2bab /lib | |
parent | f0d3d4fedbfe64c704f8f1e42b1301384b7f52aa (diff) |
[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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline.rb | 2 | ||||
-rw-r--r-- | lib/reline/ansi.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/reline.rb b/lib/reline.rb index 91863ebfea..f88c368e5c 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -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) diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index c2082c1819..36ac7257e8 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -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) |