Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling signals for non-RSpec test runners #286

Merged
merged 2 commits into from
Dec 4, 2024
Merged
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### 7.13.1

* Fix handling signals for non-RSpec test runners

https://github.com/KnapsackPro/knapsack_pro-ruby/pull/286

https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.13.0...v7.13.1

### 7.13.0

* Add `KNAPSACK_PRO_FALLBACK_MODE_ERROR_EXIT_CODE` to specify a custom exit code whenever Knapsack Pro fails because Fallback Mode cannot be used
Expand Down
5 changes: 4 additions & 1 deletion lib/knapsack_pro/runners/queue/base_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ def trap_signals
Signal.trap(signal) {
puts "#{signal} signal has been received. Terminating Knapsack Pro..."
@@terminate_process = true
RSpec.world.wants_to_quit = true
post_trap_signals
log_threads
}
end
end

def post_trap_signals
end

def log_threads
threads = Thread.list

Expand Down
4 changes: 4 additions & 0 deletions lib/knapsack_pro/runners/queue/rspec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def log_fail_fast_limit_met

private

def post_trap_signals
RSpec.world.wants_to_quit = true
ArturT marked this conversation as resolved.
Show resolved Hide resolved
end

def pre_run_setup
ENV['KNAPSACK_PRO_QUEUE_RECORDING_ENABLED'] = 'true'
ENV['KNAPSACK_PRO_QUEUE_ID'] = KnapsackPro::Config::EnvGenerator.set_queue_id
Expand Down