diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 72a97692d5..5bebc34afc 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -372,7 +372,7 @@ public ConcurrentDictionary install_run(ChocolateyConfigu this.Log().Warn(ChocolateyLoggers.Important, "Warnings:"); foreach (var warning in packageInstalls.Where(p => p.Value.Warning).or_empty_list_if_null()) { - this.Log().Warn(ChocolateyLoggers.Important, " - {0}".format_with(warning.Value.Name)); + this.Log().Warn(ChocolateyLoggers.Important, " - {0}{1}".format_with(warning.Value.Name, warning.Value.ExitCode != 0 ? " (exit code {0})".format_with(warning.Value.ExitCode) : string.Empty)); } } @@ -381,7 +381,7 @@ public ConcurrentDictionary install_run(ChocolateyConfigu this.Log().Error("Failures:"); foreach (var failure in packageInstalls.Where(p => !p.Value.Success).or_empty_list_if_null()) { - this.Log().Error(" - {0}".format_with(failure.Value.Name)); + this.Log().Error(" - {0}{1}".format_with(failure.Value.Name, failure.Value.ExitCode != 0 ? " (exit code {0})".format_with(failure.Value.ExitCode) : string.Empty)); } } @@ -574,7 +574,7 @@ public ConcurrentDictionary upgrade_run(ChocolateyConfigu this.Log().Warn(ChocolateyLoggers.Important, "Warnings:"); foreach (var warning in packageUpgrades.Where(p => p.Value.Warning).or_empty_list_if_null()) { - this.Log().Warn(ChocolateyLoggers.Important, " - {0}".format_with(warning.Value.Name)); + this.Log().Warn(ChocolateyLoggers.Important, " - {0}{1}".format_with(warning.Value.Name, warning.Value.ExitCode != 0 ? " (exit code {0})".format_with(warning.Value.ExitCode) : string.Empty)); } } @@ -583,7 +583,7 @@ public ConcurrentDictionary upgrade_run(ChocolateyConfigu this.Log().Error("Failures:"); foreach (var failure in packageUpgrades.Where(p => !p.Value.Success).or_empty_list_if_null()) { - this.Log().Error(" - {0}".format_with(failure.Value.Name)); + this.Log().Error(" - {0}{1}".format_with(failure.Value.Name, failure.Value.ExitCode != 0 ? " (exit code {0})".format_with(failure.Value.ExitCode) : string.Empty)); } } @@ -654,7 +654,7 @@ public ConcurrentDictionary uninstall_run(ChocolateyConfi this.Log().Error("Failures"); foreach (var failure in packageUninstalls.Where(p => !p.Value.Success).or_empty_list_if_null()) { - this.Log().Error(" - {0}".format_with(failure.Value.Name)); + this.Log().Error(" - {0}{1}".format_with(failure.Value.Name, failure.Value.ExitCode != 0 ? " (exit code {0})".format_with(failure.Value.ExitCode) : string.Empty)); } } diff --git a/src/chocolatey/infrastructure/results/PackageResult.cs b/src/chocolatey/infrastructure/results/PackageResult.cs index aadd6322b7..6f3d44dddd 100644 --- a/src/chocolatey/infrastructure/results/PackageResult.cs +++ b/src/chocolatey/infrastructure/results/PackageResult.cs @@ -41,6 +41,7 @@ public bool Warning public string InstallLocation { get; set; } public string Source { get; set; } public string SourceUri { get; set; } + public int ExitCode { get; set; } public PackageResult(IPackage package, string installLocation, string source = null) : this(package.Id.to_lower(), package.Version.to_string(), installLocation) {