[前][次][番号順一覧][スレッド一覧]

ruby-changes:59625

From: aycabta <ko1@a...>
Date: Sun, 5 Jan 2020 22:49:06 +0900 (JST)
Subject: [ruby-changes:59625] da028a4fbf (master): Rescue EOFError

https://git.ruby-lang.org/ruby.git/commit/?id=da028a4fbf

From da028a4fbf879144a09192c5cc4a0020c69048e0 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 5 Jan 2020 22:46:35 +0900
Subject: Rescue EOFError

If C-d is pressed before IRB is ready, IRB crashes because EOFError occurs.

diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb
index 27157f0..cd780c6 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -41,12 +41,15 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L41
   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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]