Skip to content

Commit

Permalink
Merge pull request #286 from KnapsackPro/fix-bug-rspec-in-base-class
Browse files Browse the repository at this point in the history
Fix handling signals for non-RSpec test runners
  • Loading branch information
ArturT authored Dec 4, 2024
2 parents 9dd338a + 5236858 commit bc57ddd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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
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

0 comments on commit bc57ddd

Please sign in to comment.