Skip to content

Commit

Permalink
(GH-821) ValidExitCodes not recognized return 0
Browse files Browse the repository at this point in the history
If a valid exit code specified is not recognized as one of choco's
valid exit codes, provide a warning and set the exit code to 0.
  • Loading branch information
ferventcoder committed Jun 23, 2016
1 parent af38bf2 commit 35585c3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ Elevating Permissions and running [`"$exeToRun`" $wrappedStatements]. This may t
if ($validExitCodes -notcontains $exitCode) {
Set-PowerShellExitCode $exitCode
throw "Running [`"$exeToRun`" $statements] was not successful. Exit code was '$exitCode'. See log for possible error messages."
} else {
$chocoSuccessCodes = @(0, 1605, 1614, 1641, 3010)
if ($chocoSuccessCodes -notcontains $exitCode) {
Write-Warning "Exit code '$exitCode' was considered valid, but not as a choco success code. Returning 0"
$exitCode = 0
}
}

Write-Debug "Finishing 'Start-ChocolateyProcessAsAdmin'"
Expand Down

0 comments on commit 35585c3

Please sign in to comment.