serpapi / turbo_tests

Run RSpec tests on multiple cores. Like parallel_tests but with incremental summarized output. Originally extracted from the Discourse and Rubygems source code.
https://rubygems.org/gems/turbo_tests
MIT License
173 stars 25 forks source link

Better handle interrupts #46

Open Bo98 opened 8 months ago

Bo98 commented 8 months ago

Currently if you hit Ctrl+C, the underlying rspec tests might continue to still run. This behaviours seemed to consistently happen in my environment (executed via bundle exec).

This PR adopts logic similar to parallel_tests that fixes this: https://github.com/grosser/parallel_tests/blob/6e9be6f529b64e5f9c8e4439754bca0b2ef3f2b1/lib/parallel_tests/cli.rb#L31-L54

An extra consideration for turbo_tests was that the Ctrl+C might happen before the FIFO file was written to, causing the read thread to block indefinitely. A fix for this is to make the process exit monitoring thread write to the FIFO file (if not already written to) to signal the other thread to stop.