From 713df9722168286ab3613048e82eadf072c0eaf8 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 23 Jun 2016 14:17:41 -0500 Subject: [PATCH] (GH-827) No really, ignore package exit codes If it is a valid exit code, choco used to set the exit code to zero. Otherwise the exit code was set to 1. That behavior needs to continue to be that way for the exit code of choco.exe when ignoring package exit codes. --- .../infrastructure.app/services/PowershellService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index d770278173..704e44f0d9 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -301,6 +301,11 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack failure = true; } + if (!configuration.Features.UsePackageExitCodes) + { + Environment.ExitCode = failure ? 1 : 0; + } + if (failure) { packageResult.Messages.Add(new ResultMessage(ResultType.Error, "Error while running '{0}'.{1} See log for details.".format_with(chocoPowerShellScript, Environment.NewLine)));