You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with 33b6285, which was released as part of GH-512 in
0.9.10, we started checking `$LASTEXITCODE` in addition to the script
command success. This meant it offered the ability to capture when a
script exited with `exit 1` and handle that accordingly. However that
was not a recommended scenario for returning errors from scripts.
Checking `$LastExitCode` checks the last executable's exit code when the
script specifically does not call `Exit`. This can lead to very
perplexing failures, such as running a successful xcopy that exits with
2 and seeing package failures without understanding why. Since it is
not typically recommended to call `Exit` to return a value from
PowerShell because of issues with different hosts, it's less of a
concern to only look at explicit failures.
if ($lastExecutableExitCode-ne$null-and$lastExecutableExitCode-ne'') {
53
+
Write-Debug"The last executable that ran had an exit code of '$lastExecutableExitCode'."
54
+
}
55
+
56
+
if (-not$scriptSuccess) {
57
+
Write-Debug"The script exited with a failure."
58
+
}
59
+
60
+
$exitCode=0
61
+
if ($env:ChocolateyCheckLastExitCode-ne$null-and$env:ChocolateyCheckLastExitCode-eq'true'-and$lastExecutableExitCode-ne$null-and$lastExecutableExitCode-ne'') {
0 commit comments