Skip to content

Add 'CancellableAsyncCommand' for graceful CTRL + C termination #69

@TraGicCode

Description

@TraGicCode

https://github.com/aws/aws-lambda-dotnet/blob/36d9cc35b41ffcd8b24a684bba9d0db8d157d491/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Commands/CancellableAsyncCommand.cs#L12

https://github.com/Inok/NuGet.Promoter/blob/88ca40d51b7bd217c40079172c7bdbedd7f8834c/src/Promote.NuGet/CancellableAsyncCommand.cs

  // Customize help and error messages
                  config.SetExceptionHandler((ex, resolver) =>
                                             {
                                                 if (ex is InvalidOperationException && ex.Message.Contains("Configuration is incomplete"))
                                                 {
                                                     // Don't show the full exception for configuration errors
                                                     AnsiConsole.MarkupLine($"[red]{ex.Message}[/]");
                                                     return -1;
                                                 }

                                                 AnsiConsole.WriteException(ex);
                                                 return -1;
                                             });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions