ruby-changes:70383
From: aycabta <ko1@a...>
Date: Tue, 21 Dec 2021 00:49:22 +0900 (JST)
Subject: [ruby-changes:70383] 37aea9d798 (master): [ruby/reline] Finalize when exception occurred
https://git.ruby-lang.org/ruby.git/commit/?id=37aea9d798 From 37aea9d7984d9bf884df121ab0b44168ae1ac0c5 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Tue, 21 Dec 2021 00:16:32 +0900 Subject: [ruby/reline] Finalize when exception occurred https://github.com/ruby/reline/commit/1f8a3aee43 Co-authored-by: Alex Gittemeier <me@a...> --- lib/reline.rb | 7 ++++++- lib/reline/line_editor.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/reline.rb b/lib/reline.rb index 88f1df3995a..a9fc49b416f 100644 --- a/lib/reline.rb +++ b/lib/reline.rb @@ -290,7 +290,6 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L290 may_req_ambiguous_char_width line_editor.reset(prompt, encoding: Reline::IOGate.encoding) - line_editor.set_signal_handlers if multiline line_editor.multiline_on if block_given? @@ -320,6 +319,7 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L319 line_editor.rerender begin + line_editor.set_signal_handlers prev_pasting_state = false loop do prev_pasting_state = Reline::IOGate.in_pasting? @@ -348,6 +348,11 @@ module Reline https://github.com/ruby/ruby/blob/trunk/lib/reline.rb#L348 line_editor.finalize Reline::IOGate.deprep(otio) raise e + rescue Exception + # Including Interrupt + line_editor.finalize + Reline::IOGate.deprep(otio) + raise end line_editor.finalize diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 2c458388cdd..9b206d9adfd 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -235,7 +235,7 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L235 when 'EXIT' exit else - @old_trap.call + @old_trap.call if @old_trap.respond_to?(:call) end } begin -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/