Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec/core/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def self.trap_interrupt
# @private
def self.handle_interrupt
if RSpec.world.wants_to_quit
exit!(1)
exit(1)
else
RSpec.world.wants_to_quit = true
$stderr.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
Expand Down
8 changes: 4 additions & 4 deletions spec/rspec/core/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ module RSpec::Core
end

describe "interrupt handling" do
before { allow(Runner).to receive(:exit!) }
before { allow(Runner).to receive(:exit) }

it 'prints a message the first time, then exits the second time' do
expect {
Runner.handle_interrupt
}.to output(/shutting down/).to_stderr_from_any_process &
change { RSpec.world.wants_to_quit }.from(a_falsey_value).to(true)

expect(Runner).not_to have_received(:exit!)
expect(Runner).not_to have_received(:exit)

expect {
Runner.handle_interrupt
}.not_to output.to_stderr_from_any_process

expect(Runner).to have_received(:exit!)
expect(Runner).to have_received(:exit)
end
end

Expand Down Expand Up @@ -149,7 +149,7 @@ def interrupt
context "with SIGINT twice" do
it "exits immediately" do
Runner.send(:trap_interrupt)
expect(Runner).to receive(:exit!).with(1)
expect(Runner).to receive(:exit).with(1)
expect { interrupt }.to output(//).to_stderr
interrupt
end
Expand Down