How do I get errors to propagate in the TeamCity PowerShell runner

后端 未结 10 2210
轻奢々
轻奢々 2020-12-05 23:47

I have a TeamCity 7 Build Configuration which is pretty much only an invocation of a .ps1 script using various TeamCity Parameters.

I was hoping that mig

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 00:14

    Powershell v2 atleast had an issue with the -File option messing up error codes. There is some details about how it messes up and stuff.

    The answer is either switch to -Command option and/or wrap it with a bat file that checks the LastErrorCode and returns 1+ if its supposed to fail.

    http://zduck.com/2012/powershell-batch-files-exit-codes/

提交回复
热议问题