-
Notifications
You must be signed in to change notification settings - Fork 381
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
Support Ctrl+C handling #290
Conversation
I reimplemented this using middleware and added a middleware for |
I'll look at adding some tests when we settled on a public API. |
Tests will be important for helping understand how this is intended to be used and to make sure it's not regressed during refactoring. This is particularly important because we still plan to decompose |
…on with UseExceptionHandler
…ndler. The user should catch this exception.
src/System.CommandLine/Invocation/MethodBindingCommandHandler.cs
Outdated
Show resolved
Hide resolved
The lock in |
src/System.CommandLine.Tests/CancelOnProcessTerminationTests.cs
Outdated
Show resolved
Hide resolved
… AddCancellationHandling method
} | ||
} | ||
|
||
private sealed class RemoteExecutionException : XunitException |
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.
I don't think the base exception type needs to be Xunit-specific.
Ready to merge! |
What do you want to do with |
If you'd like to remove it from the PR and push it to the wiki, feel free. I'll figure out where to link to it. |
I've copied it here: https://github.com/dotnet/System.CommandLine/wiki/Process-termination-handling |
🎉 |
An initial attempt at implementing #259.
This adds a
Canceled
property andCancel
method to the InvocationContext.This is similar to the
RequestAborted
andAbort
methods on HttpContext.I'm doing an early PR to get some feedback.
It won't compile on my system, running
./build.sh
gives me errors: