-
Notifications
You must be signed in to change notification settings - Fork 358
Add OnInterrupt to run function code on CTRL+C #301
Conversation
@AlecAivazis I'm interested in managing this repository. |
Hey @infixint943! Thanks for submitting this. Do you mind adding tests and some documentation to go with the new feature? Also, I appreciate the offer to help maintain this library. For now, the best way to help is to answer questions that pop up on issues and keep submitting PRs. |
Thinking about this API more i think its important that we don't just add something to the top-level API. we probably want to have a |
Usually, I end up terminating the process when I encounter a How good would this inclusion be? |
I think having both is the right move 👍 |
@infixint943 any progress on adding the option? |
Hey! |
Should I rename the global |
I think something simply like |
Done! |
Thinking about this name some more, i think |
@AlecAivazis Can you please investigate why tests keep timing out randomly, in my PR? |
Hey @infinitepr0, sorry you are running into timeout issues with the tests. Unforunately, i dont have a lot of free time to hunt this down right now :( |
This may sound stupid, but how do I make the tests send a
|
@infinitepr0 any progress? |
Sorry for the delay (and thanks for the reminder). |
Requesting you to review this PR @AlecAivazis |
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.
Do you mind explaining why you changed the way errors are handled in tests?
@@ -28,7 +28,6 @@ func RunTest(t *testing.T, procedure func(*expect.Console), test func(terminal.S | |||
}() | |||
|
|||
err = test(Stdio(c)) | |||
require.Nil(t, err) |
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.
was this intentionally removed? If so, can you explain why?
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.
Yes, because, L#30 would return an error when SIGINT was encountered, and the tests would fail (due to the assert). So I shifted the error assertion to the helper functions (RunPromptTest
and the other one).
I could revert this, but that would mean rewriting another RunTest
function exclusively for the OnInterrupt test, which isn't a very good idea imo.
@AlecAivazis Sorry for disturbing, but can you please review the PR and merge it is all's well. Thanks. |
Sure thing! Thanks for the reminder 👍 |
Thanks a lot! |
This reverts commit 90b418e.
No description provided.