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

ruby-changes:62623

From: aycabta <ko1@a...>
Date: Tue, 18 Aug 2020 19:16:09 +0900 (JST)
Subject: [ruby-changes:62623] 215fe54777 (master): [ruby/reline] Check Errno::EIO

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

From 215fe54777c7183198d9789b25ea0e0af016261b Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sat, 4 Jul 2020 00:42:06 +0900
Subject: [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

diff --git a/lib/reline.rb b/lib/reline.rb
index 91863eb..f88c368 100644
--- a/lib/reline.rb
+++ b/lib/reline.rb
@@ -243,6 +243,8 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L243
           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 c2082c1..36ac725 100644
--- a/lib/reline/ansi.rb
+++ b/lib/reline/ansi.rb
@@ -67,6 +67,9 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L67
     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)
-- 
cgit v0.10.2


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

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