audit, advisories and doctors/setup work
This commit is contained in:
@@ -10,13 +10,27 @@ public static class PolicySimulationSmokeApp
|
||||
var root = PolicySimulationSmokeCommand.Build(runner);
|
||||
var parseResult = root.Parse(args, new ParserConfiguration());
|
||||
var invocationConfiguration = new InvocationConfiguration();
|
||||
|
||||
if (parseResult.Errors.Count > 0)
|
||||
using var cancellationSource = new CancellationTokenSource();
|
||||
ConsoleCancelEventHandler? handler = (_, e) =>
|
||||
{
|
||||
await parseResult.InvokeAsync(invocationConfiguration, CancellationToken.None);
|
||||
return 64; // EX_USAGE
|
||||
}
|
||||
e.Cancel = true;
|
||||
cancellationSource.Cancel();
|
||||
};
|
||||
Console.CancelKeyPress += handler;
|
||||
|
||||
return await parseResult.InvokeAsync(invocationConfiguration, CancellationToken.None);
|
||||
try
|
||||
{
|
||||
if (parseResult.Errors.Count > 0)
|
||||
{
|
||||
await parseResult.InvokeAsync(invocationConfiguration, cancellationSource.Token);
|
||||
return 64; // EX_USAGE
|
||||
}
|
||||
|
||||
return await parseResult.InvokeAsync(invocationConfiguration, cancellationSource.Token);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.CancelKeyPress -= handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user