Skip to content

Commit 38a4d69

Browse files
committed
fixup! Remove InvocationLifetime class
1 parent c6bb401 commit 38a4d69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/System.CommandLine.Hosting/HostingAction.cs

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ public override async Task<int> InvokeAsync(ParseResult parseResult, Cancellatio
5050
?? new HostBuilder();
5151
hostBuilder.Properties[typeof(ParseResult)] = parseResult;
5252

53+
// As long as done before first await,
54+
// we can set the process termination timeout to null
55+
// and let the .NET Host ConsoleLifetime deal with termination
56+
parseResult.Configuration.ProcessTerminationTimeout = null;
57+
hostBuilder.UseConsoleLifetime();
58+
5359
if (parseResult.Configuration.RootCommand is RootCommand root &&
5460
root.Directives.SingleOrDefault(d => d.Name == HostingDirectiveName) is { } directive)
5561
{

0 commit comments

Comments
 (0)