debrew/irb: fix trap handling

This commit is contained in:
Bo Anderson 2021-04-13 17:41:35 +01:00
parent ac87404c34
commit 56a72fe2b1
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -5,8 +5,6 @@ require "irb"
# @private # @private
module IRB module IRB
def self.parse_opts(argv: nil); end
def self.start_within(binding) def self.start_within(binding)
unless @setup_done unless @setup_done
setup(nil, argv: []) setup(nil, argv: [])
@ -19,7 +17,7 @@ module IRB
@CONF[:IRB_RC]&.call(irb.context) @CONF[:IRB_RC]&.call(irb.context)
@CONF[:MAIN_CONTEXT] = irb.context @CONF[:MAIN_CONTEXT] = irb.context
trap("SIGINT") do prev_trap = trap("SIGINT") do
irb.signal_handle irb.signal_handle
end end
@ -28,6 +26,7 @@ module IRB
irb.eval_input irb.eval_input
end end
ensure ensure
trap("SIGINT", prev_trap)
irb_at_exit irb_at_exit
end end
end end