Cake.Powershell
Cake.Powershell copied to clipboard
No error is throw when exit code is not equal to `1`
Not sure if this is intentional or not but I expect that running the following script would throw an exception with a none 0 exit code?
TestScript.ps1
exit 1
build.cake
Task("Default")
.Does(() =>
{
StartPowershellFile("TestScript.ps1");
});
I would be happy to change this but I'm wary that it makes assumptions about the scripts people are running. I'll leave this issue open and see if anyone chimes in on the conversation 👍
Cool, at the moment I've worked around it with a Write-Error
which then throws an exception.
Write-Error "Error Code Not Zero"
exit 1
A lot of deployment tools when running PowerShell scripts check the return code, It's why I had the assumption it should throw an exception back up and fail the build step.
I'm also happy to change the code and submit a pull request if you're happy to push in this feature?