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

ruby-changes:67038

From: aycabta <ko1@a...>
Date: Wed, 4 Aug 2021 18:30:07 +0900 (JST)
Subject: [ruby-changes:67038] de93b8b069 (master): Handle SIGINT in other thread correctly

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

From de93b8b0697ab9554557f21d7a52a3172c5af5c3 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 1 Aug 2021 17:41:55 +0900
Subject: Handle SIGINT in other thread correctly

Co-authored-by: Koichi Sasada <ko1@a...>
---
 lib/reline/line_editor.rb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 6257331..97f1211 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -158,8 +158,16 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L158
       end
       Reline::IOGate.move_cursor_column(0)
       scroll_down(1)
-      @old_trap.call if @old_trap.respond_to?(:call) # can also be string, ex: "DEFAULT"
-      raise Interrupt
+      case @old_trap
+      when 'DEFAULT', 'SYSTEM_DEFAULT'
+        raise Interrupt
+      when 'IGNORE'
+        # Do nothing
+      when 'EXIT'
+        exit
+      else
+        @old_trap.call
+      end
     }
     Reline::IOGate.set_winch_handler do
       @rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
-- 
cgit v1.1


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

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