diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 9e8f5ab478..7c98ab7257 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -412,6 +412,8 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu ensure_bad_package_path_is_clean(config, packageResult); EventManager.publish(new HandlePackageResultCompletedMessage(packageResult, config, commandName)); + remove_pending(packageResult, config); + if (!packageResult.Success) { this.Log().Error(ChocolateyLoggers.Important, "The {0} of {1} was NOT successful.".format_with(commandName.to_string(), packageResult.Name)); @@ -421,9 +423,7 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu } remove_rollback_if_exists(packageResult); - - if (packageResult.Success) remove_pending(packageResult, config); - + this.Log().Info(ChocolateyLoggers.Important, " The {0} of {1} was successful.".format_with(commandName.to_string(), packageResult.Name)); var installLocation = Environment.GetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallLocation); @@ -1193,7 +1193,7 @@ public void remove_pending(PackageResult packageResult, ChocolateyConfiguration fileLock.Dispose(); } - if (_fileSystem.file_exists(pendingFile)) _fileSystem.delete_file(pendingFile); + if (packageResult.Success && _fileSystem.file_exists(pendingFile)) _fileSystem.delete_file(pendingFile); } private IEnumerable get_environment_before(ChocolateyConfiguration config, bool allowLogging = true)