-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
In 2.0.0-rc.1.25451.107
CancellationTokens are not working by default.
RootCommand rootCommand = new();
rootCommand.SetAction(async (parseResult, cancellationToken) => {
cancellationToken.Register(() => Console.WriteLine("Cancellation requested"));
await Task.Delay(10000, cancellationToken);
return 0;
});
await rootCommand.Parse(args).InvokeAsync();
Please write docs on how properly handle process cancellation to gracefully exit the app.
Here are some scenarios where we might want to gracefully exit app:
- user invoked CLI -> user pressed Ctrl+C
- kubernetes job -> job cancelling by k8s controller
- windows service -> service stopping
Metadata
Metadata
Assignees
Labels
No labels