1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/irb] SIGINT should raise Interrupt after IRB session

https://github.com/ruby/irb/commit/5832cfe75b
This commit is contained in:
Koichi Sasada 2021-04-01 19:06:10 +09:00 committed by git
parent 8e636bd0de
commit 1ac68bba4e
2 changed files with 8 additions and 1 deletions

View file

@ -472,7 +472,7 @@ module IRB
conf[:IRB_RC].call(context) if conf[:IRB_RC]
conf[:MAIN_CONTEXT] = context
trap("SIGINT") do
prev_trap = trap("SIGINT") do
signal_handle
end
@ -481,6 +481,7 @@ module IRB
eval_input
end
ensure
trap("SIGINT", prev_trap)
conf[:AT_EXIT].each{|hook| hook.call}
end
end

View file

@ -64,6 +64,12 @@ module TestIRB
ENV["IRBRC"] = backup_irbrc
end
def test_recovery_sigint
bundle_exec = ENV.key?('BUNDLE_GEMFILE') ? ['-rbundler/setup'] : []
status = assert_in_out_err(bundle_exec + %w[-W0 -rirb -e binding.irb;loop{Process.kill("SIGINT",$$)} -- -f --], "exit\n", //, //)
Process.kill("SIGKILL", status.pid) if !status.exited? && !status.stopped? && !status.signaled?
end
private
def with_argv(argv)