summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-01-05 22:46:35 +0900
committeraycabta <aycabta@gmail.com>2020-01-05 22:48:39 +0900
commitda028a4fbf879144a09192c5cc4a0020c69048e0 (patch)
tree232fbef082a90749e35e68165c82855c0d68ff55 /lib
parent54fd50c951d7bee259bcbc491bf223fb992d12c9 (diff)
Rescue EOFError
If C-d is pressed before IRB is ready, IRB crashes because EOFError occurs.
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/ansi.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb
index 27157f0db9..cd780c6189 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -41,12 +41,15 @@ class Reline::ANSI
end
def self.retrieve_keybuffer
+ begin
result = select([@@input], [], [], 0.001)
return if result.nil?
str = @@input.read_nonblock(1024)
str.bytes.each do |c|
@@buf.push(c)
end
+ rescue EOFError
+ end
end
def self.get_screen_size