-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Add a way to disable adding interrupts. #2689
Comments
@ioquatix can you please submit a minimal reproduction case that fails with |
Hm, they carry over to children? I mean we trap our |
Yes it carries to children. |
Here is a working example:
|
edit: deleted comment was duplicate code, removed for clarity Thats less than ideal... but you might be waiting forever with no way to quit if you disabled our handler, I'm not adverse to adding a way to suppress it however... |
Is it possible to remove them? I vaguely remember issues with puma in a similar vein, I'm wondering if we can provide a method instead, wrap a test inside a "no trap" handler which has a backup timeout kill before restoring the old one? |
If I was building RSpec, I'd want it to be minimally invasive on program state. Even minitest gets this quite wrong IMHO: minitest/minitest#429 As signals are part of user code state, even if it's not traditionally something that needs to be tested, it does affect the behaviour of user-facing interfaces. So, my suggestion would be to find a different solution. If the user presses Ctrl-C, the main thread will raise an So:
|
Also, another point, pressing Ctrl-C, I expect a backtrace, but right now it gets swallowed up and often I never see it if the test has actually failed due to some blocking operation - presssing Ctrl-C to cancel the tests doesn't print any output. |
The expected behaviour is that the first |
If the test will never finish, pressing Ctrl-C a second time exits with no backtrace. Is this intentional? |
Not intentional, just a side effect of implementation, a second |
I think you should make this behaviour optional and I'd probably immediately disable it in my template Rspec configuration, because I find it so annoying when debugging that exceptions are swallowed and backtraces are not printed. |
As I said, open to improving this if you want to work on something better, but current behaviour needs to be preserved by default :) |
Okay, I'll make a PR. |
Here is the PR, can you please check it? Thanks. |
In code which needs to test fork and other process related functions, it should be possible to disable the interrupt handler, which interferes with code which has it's own signal handlers.
rspec-core/lib/rspec/core/runner.rb
Line 65 in d730c02
Suggest something like
config.disable_signal_handlers!
or something similar.The text was updated successfully, but these errors were encountered: