@@ -39,6 +39,10 @@ $installargs = Get-Attr -obj $params -name install_args -default $null
3939$packageparams = Get-Attr - obj $params - name params - default $null
4040$ignoredependencies = Get-Attr - obj $params - name ignore_dependencies - default " false" | ConvertTo-Bool
4141
42+ # as of chocolatey 0.9.10, nonzero success exit codes can be returned
43+ # see https://github.com/chocolatey/choco/issues/512#issuecomment-214284461
44+ $successexitcodes = (0 , 1605 , 1614 , 1641 , 3010 )
45+
4246if (" present" , " absent" -notcontains $state )
4347{
4448 Fail- Json $result " state is $state ; must be present or absent"
@@ -159,7 +163,7 @@ Function Choco-Upgrade
159163
160164 $results = invoke-expression $cmd
161165
162- if ($LastExitCode -ne 0 )
166+ if ($LastExitCode -notin $successexitcodes )
163167 {
164168 Set-Attr $result " choco_error_cmd" $cmd
165169 Set-Attr $result " choco_error_log" " $results "
@@ -244,7 +248,7 @@ Function Choco-Install
244248
245249 $results = invoke-expression $cmd
246250
247- if ($LastExitCode -ne 0 )
251+ if ($LastExitCode -notin $successexitcodes )
248252 {
249253 Set-Attr $result " choco_error_cmd" $cmd
250254 Set-Attr $result " choco_error_log" " $results "
@@ -286,7 +290,7 @@ Function Choco-Uninstall
286290
287291 $results = invoke-expression $cmd
288292
289- if ($LastExitCode -ne 0 )
293+ if ($LastExitCode -notin $successexitcodes )
290294 {
291295 Set-Attr $result " choco_error_cmd" $cmd
292296 Set-Attr $result " choco_error_log" " $results "
0 commit comments