-
Notifications
You must be signed in to change notification settings - Fork 153
fix: graceful exit using ctrl+C if not test are running #515
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR!
There's already a signal handler added in newSignalHandler
. That forwards signals to tests so that the first Ctrl-c
cancels the tests instead of exiting gotestsum
.
I think this will need to integrate with that function somehow.
I managed to use same |
This will return exit code 0 if gotestsum is waiting for any changes and it is interrupted, otherwise if some tests are running using ctrl+c it interrputs the tests and exit with status 1. Closes gotestyourself#508
@ccoVeille i kept the interface, it is super useful in testing, I added a comment to explicty say this :D |
@dnephin if you have other concerns let me know :D |
@ccoVeille do you think i need other changes here? |
Nope, the PR is fine and could be merged by a maintainer according to me. |
This will return exit code 0 if gotestsum is waiting for any changes and
it is interrupted, otherwise if some tests are running using ctrl+c it
interrupts the tests and exit with status 1.
The refactoring here is for using a single context and propagate over the other processes/functions.
This way is more clear where we cancel and what we do in sub-fuction at the moment of finishing the context.
No double signlar handlers are created.
Closes #508