diff --git a/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs b/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs index 9af4dc93d..cef18b377 100644 --- a/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs +++ b/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs @@ -172,8 +172,8 @@ public async Task InstallPackage( using (await Lock.WriteLockAsync()) { var logger = new SerilogLogger(Logger, _progressService); - var choco = Lets.GetChocolatey(initializeLogging: false).SetCustomLogging(logger, logExistingMessages: false, addToExistingLoggers: false); - choco.Set( + var currentConfig = _choco.GetConfiguration(); + _choco.Set( config => { config.CommandName = CommandNameType.install.ToString(); @@ -244,7 +244,7 @@ public async Task InstallPackage( using (logger.Intercept(grabErrors)) { - await choco.RunAsync(); + await _choco.RunAsync(); if (Environment.ExitCode != 0) { @@ -252,6 +252,10 @@ public async Task InstallPackage( return new PackageOperationResult { Successful = false, Messages = errors.ToArray() }; } + _choco.Set(config => + { + config = currentConfig; + }); return PackageOperationResult.SuccessfulCached; } }