Skip to content

Loading…

Fixed bug where exit code didn't bubble when used with -File option #17

Merged
merged 1 commit into from

3 participants

@mboltuc

While trying to use TeamCity to run some of my psake tasks using the -File option, the error codes didn't bubble up. Adding $host.SetShouldExit fixed this issue for me.

@JamesKovacs JamesKovacs merged commit f8ee95a into psake:master
@JamesKovacs
psake member

Thanks for the patch.

@whut
psake member

Could you check if your issue still happens in newest psake? I could not reproduce your issue (I don't have TeamCity), and after merging #21 there is no host.SetShouldExit.

@mboltuc
@whut
psake member

Hi,

It would be great if you could check if your issue still happens in newest psake. You will probably need to use psake.cmd to run psake from TeamCity, or at least use approach shown in there

@whut
psake member

Whats up?

@mboltuc
@whut
psake member

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 2 additions and 1 deletion.
  1. +2 −1 psake.psm1
View
3 psake.psm1
@@ -374,6 +374,7 @@ function Invoke-psake {
# Need to return a non-zero DOS exit code so that CI server's (Hudson, TeamCity, etc...) can detect a failed job
if ((IsChildOfService)) {
+ $host.SetShouldExit($psake.config.exitCode)
exit($psake.config.exitCode)
}
}
@@ -643,4 +644,4 @@ $psake.context = new-object system.collections.stack # holds onto the current st
Load-Configuration
-export-modulemember -function invoke-psake, invoke-task, task, properties, include, formattaskname, tasksetup, taskteardown, assert, exec -variable psake
+export-modulemember -function invoke-psake, invoke-task, task, properties, include, formattaskname, tasksetup, taskteardown, assert, exec -variable psake
Something went wrong with that request. Please try again.