diff --git a/src/Community.Extensions.Spectre.Cli.Hosting/SpectreConsoleWorker.cs b/src/Community.Extensions.Spectre.Cli.Hosting/SpectreConsoleWorker.cs
index 22a4879..d3227e0 100644
--- a/src/Community.Extensions.Spectre.Cli.Hosting/SpectreConsoleWorker.cs
+++ b/src/Community.Extensions.Spectre.Cli.Hosting/SpectreConsoleWorker.cs
@@ -7,30 +7,15 @@ namespace Community.Extensions.Spectre.Cli.Hosting;
///
/// A background service that runs the Spectre Console App
///
-public class SpectreConsoleWorker : BackgroundService
+public class SpectreConsoleWorker(
+ ILogger logger,
+ ICommandApp commandApp,
+ IHostApplicationLifetime hostLifetime) : BackgroundService
{
- private readonly ICommandApp _commandApp;
-
- private readonly IHostApplicationLifetime _hostLifetime;
-
- private readonly ILogger _logger;
-
- private int _exitCode;
-
///
+ /// The exit code returned by the Spectre Console App
///
- ///
- ///
- ///
- public SpectreConsoleWorker(ILogger logger, ICommandApp commandApp,
- IHostApplicationLifetime hostLifetime)
- {
- _logger = logger;
- _commandApp = commandApp;
- _hostLifetime = hostLifetime;
-
- logger.LogDebug("Constructed");
- }
+ private int _exitCode;
///
/// This method is called when the starts. The
@@ -49,26 +34,26 @@ public SpectreConsoleWorker(ILogger logger, ICommandApp co
///
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
- _logger.LogDebug("๐งต Console Background Worker Started");
+ logger.LogDebug("๐งต Console Background Worker Started");
try
{
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
- _logger.LogTrace("_commandApp.RunAsync(args)");
+ logger.LogTrace("_commandApp.RunAsync(args)");
- _exitCode = await _commandApp.RunAsync(args);
+ _exitCode = await commandApp.RunAsync(args);
}
catch (Exception ex)
{
- _logger.LogError(ex, "An unexpected error occurred");
+ logger.LogError(ex, "An unexpected error occurred");
_exitCode = 1;
}
finally
{
- _logger.LogDebug("๐ Console Background Worker Stopping");
+ logger.LogDebug("๐ Console Background Worker Stopping");
Environment.ExitCode = _exitCode;
- _hostLifetime.StopApplication();
+ hostLifetime.StopApplication();
}
}
}
\ No newline at end of file
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index b7d8c10..e5159d8 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,15 +1,12 @@
-
-
-
true
preview
true
embedded
true
- 1.0
+ 1.1
true
false