summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/reline.rb2
-rw-r--r--lib/reline/ansi.rb3
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)