Skip to content
Discussion options

You must be logged in to vote

I wanted to disable System.CommandLine's handling of ctrl-c... and after hunting through the code wrote this:

var parse = Cli.RootCommand.Parse(args);
parse.InvocationConfiguration.EnableDefaultExceptionHandler = false;
// Disable ^c (etc.) handling
parse.InvocationConfiguration.ProcessTerminationTimeout = null;
var canTok = SetupInterrupt();

return await parse.InvokeAsync(cancellationToken: canTok);

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ptr727
Comment options

@ptr727
Comment options

@ptr727
Comment options

Answer selected by ptr727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants