Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Forcing exit code of Invoke-PSake to the build status. Resolution to bug #23 #24

Closed
wants to merge 2 commits into from

2 participants

@toddhgardner

Exit with the return code of build_success forces the return code to 0 if the build was successful, non-zero if unsuccessful.

toddhgardner added some commits
@toddhgardner toddhgardner Exit with the return code of build_success forces the return code to …
…0 if the build was successful, non-zero if unsuccessful.
5831490
@toddhgardner toddhgardner Added textcolor parameter to invoke-psake to change the color that ta…
…sk titles print in. Allows for better visibility on dark consoles.
145232c
@whut
Owner

Thanks for spotting that bug! Fixed in commit e17c6dd, but in a different way.

Invoke-Psake should never exit and set exit code, because that would exit whole powershell process (Invoke-Psake is not process, is a function called inside powershell process). After calling Invoke-Psake check $psake.build_success variable, something like that was recenlty added to psake.cmd, and now I updated it to fix your bug.

@whut
Owner

I can't accept your other commit, it's incomplete. If you wan't ability to change colors used for psake make it configurable for all colors used by psake (currently blue - info, yellow - warning, red - error, green - success), not only for blue, probably as settings in psake-config.ps1.

But right, blue is not very visible on darker consoles, so I changed it to Cyan in 9d8903c. This color is used by msbuild, and is commonly recomended, for example here. I hope it will work for you.

@whut whut closed this
@toddhgardner

Awesome dude; thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 4, 2011
  1. @toddhgardner

    Exit with the return code of build_success forces the return code to …

    toddhgardner authored
    …0 if the build was successful, non-zero if unsuccessful.
  2. @toddhgardner

    Added textcolor parameter to invoke-psake to change the color that ta…

    toddhgardner authored
    …sk titles print in. Allows for better visibility on dark consoles.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 psake.psm1
View
8 psake.psm1
@@ -52,7 +52,7 @@ function Invoke-Task
$precondition_is_valid = & $task.Precondition
if (!$precondition_is_valid) {
- Write-ColoredOutput ($msgs.precondition_was_false -f $taskName) -foregroundcolor Blue
+ Write-ColoredOutput ($msgs.precondition_was_false -f $taskName) -foregroundcolor $textcolor
} else {
if ($taskKey -ne 'default') {
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
@@ -78,7 +78,7 @@ function Invoke-Task
if ($currentContext.config.taskNameFormat -is [ScriptBlock]) {
& $currentContext.config.taskNameFormat $taskName
} else {
- Write-ColoredOutput ($currentContext.config.taskNameFormat -f $taskName) -foregroundcolor Blue
+ Write-ColoredOutput ($currentContext.config.taskNameFormat -f $taskName) -foregroundcolor $textcolor
}
foreach ($variable in $task.requiredVariables) {
@@ -259,7 +259,8 @@ function Invoke-psake {
[Parameter(Position = 3, Mandatory = 0)][switch] $docs = $false,
[Parameter(Position = 4, Mandatory = 0)][hashtable] $parameters = @{},
[Parameter(Position = 5, Mandatory = 0)][hashtable] $properties = @{},
- [Parameter(Position = 6, Mandatory = 0)][switch] $nologo = $false
+ [Parameter(Position = 6, Mandatory = 0)][switch] $nologo = $false,
+ [Parameter(Position = 7, Mandatory = 0)][string] $textcolor = "Blue"
)
try {
if (-not $nologo) {
@@ -393,6 +394,7 @@ function Invoke-psake {
}
} finally {
Cleanup-Environment
+ exit($psake.build_success)
}
} #Invoke-psake
Something went wrong with that request. Please try again.