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:
parent
8e636bd0de
commit
1ac68bba4e
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue