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
In
2.0.0-rc.1.25451.107CancellationTokens are not working by default.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: