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

ruby-changes:67644

From: aycabta <ko1@a...>
Date: Tue, 7 Sep 2021 01:59:23 +0900 (JST)
Subject: [ruby-changes:67644] 4885a61b12 (master): [ruby/reline] Rescue ArgumentError from Signal.trap(:TSTP) on Windows

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

From 4885a61b124967afc06a38d317225d02270d9dce Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Tue, 7 Sep 2021 01:57:00 +0900
Subject: [ruby/reline] Rescue ArgumentError from Signal.trap(:TSTP) on Windows

https://github.com/ruby/reline/commit/8da8182d1c
---
 lib/reline/line_editor.rb | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index a2ad758..33bcba4 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -170,10 +170,13 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L170
         @old_trap.call
       end
     }
-    @old_tstp_trap = Signal.trap(:TSTP) {
-      Reline::IOGate.ungetc("\C-z".ord)
-      @old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
-    }
+    begin
+      @old_tstp_trap = Signal.trap(:TSTP) {
+        Reline::IOGate.ungetc("\C-z".ord)
+        @old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
+      }
+    rescue ArgumentError
+    end
     Reline::IOGate.set_winch_handler do
       @rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
       old_screen_size = @screen_size
@@ -215,7 +218,10 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L218
 
   def finalize
     Signal.trap('SIGINT', @old_trap)
-    Signal.trap('SIGTSTP', @old_tstp_trap)
+    begin
+      Signal.trap('SIGTSTP', @old_tstp_trap)
+    rescue ArgumentError
+    end
   end
 
   def eof?
-- 
cgit v1.1


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

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