Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for psake.ps1 and psake.cmd errorlevel/lastexitcode based on build_success #47

Closed
wants to merge 1 commit into from

2 participants

@rbevers

If I run psake.ps1 on my continuous integration server and it doesn't result in a non-zero errorlevel somebody's going to have a false-positive at some point... In a basic test, ".\build.ps1 idontexist" the $lastexitcode was still zero. Similarly, running ".\build.cmd idontexist" is the same.

It looks like psake.psm1 is catching all throws, spitting them out in red, and setting $psake.build_success = false. This tells me that the errorlevel/$lastexitcode should be based on $psake.build_success or is an uncaught exception that should bubble out.

Hope you find this useful to the community.

@rbevers rbevers Fixed errorlevel/$lastexitcode handling based on $psake.build_success…
…, so that it works consistently for psake.ps1 and psake.cmd in both PowerShell window or Command Prompt window.
642901f
@JamesKovacs
Owner

This appears to have been resolved in a similar manner with another commit. If it is still an issue, please update your pull request and reopen. (Apologies for not reviewing this earlier. For some reason, I stopped getting notifications. My bad.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 15, 2012
  1. @rbevers

    Fixed errorlevel/$lastexitcode handling based on $psake.build_success…

    rbevers authored
    …, so that it works consistently for psake.ps1 and psake.cmd in both PowerShell window or Command Prompt window.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +4 −1 psake.cmd
  2. +3 −0  psake.ps1
View
5 psake.cmd
@@ -4,7 +4,10 @@ if '%1'=='/?' goto help
if '%1'=='-help' goto help
if '%1'=='-h' goto help
-powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }"
+powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*"
+if errorlevel 1 (
+ exit /b 1
+)
goto :eof
:help
View
3  psake.ps1
@@ -44,3 +44,6 @@ if (-not(test-path $buildFile)) {
}
invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo
+if (-not($psake.build_success)) {
+ exit 1
+}
Something went wrong with that request. Please try again.