[ruby/reline] Finalize when exception occurred
https://github.com/ruby/reline/commit/1f8a3aee43 Co-authored-by: Alex Gittemeier <me@a.lexg.dev>
This commit is contained in:
parent
c3a3f65b45
commit
37aea9d798
@ -290,7 +290,6 @@ module Reline
|
|||||||
|
|
||||||
may_req_ambiguous_char_width
|
may_req_ambiguous_char_width
|
||||||
line_editor.reset(prompt, encoding: Reline::IOGate.encoding)
|
line_editor.reset(prompt, encoding: Reline::IOGate.encoding)
|
||||||
line_editor.set_signal_handlers
|
|
||||||
if multiline
|
if multiline
|
||||||
line_editor.multiline_on
|
line_editor.multiline_on
|
||||||
if block_given?
|
if block_given?
|
||||||
@ -320,6 +319,7 @@ module Reline
|
|||||||
line_editor.rerender
|
line_editor.rerender
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
line_editor.set_signal_handlers
|
||||||
prev_pasting_state = false
|
prev_pasting_state = false
|
||||||
loop do
|
loop do
|
||||||
prev_pasting_state = Reline::IOGate.in_pasting?
|
prev_pasting_state = Reline::IOGate.in_pasting?
|
||||||
@ -348,6 +348,11 @@ module Reline
|
|||||||
line_editor.finalize
|
line_editor.finalize
|
||||||
Reline::IOGate.deprep(otio)
|
Reline::IOGate.deprep(otio)
|
||||||
raise e
|
raise e
|
||||||
|
rescue Exception
|
||||||
|
# Including Interrupt
|
||||||
|
line_editor.finalize
|
||||||
|
Reline::IOGate.deprep(otio)
|
||||||
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
line_editor.finalize
|
line_editor.finalize
|
||||||
|
@ -235,7 +235,7 @@ class Reline::LineEditor
|
|||||||
when 'EXIT'
|
when 'EXIT'
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
@old_trap.call
|
@old_trap.call if @old_trap.respond_to?(:call)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user