Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error is throw when exit code is not equal to 1 #54

Open
kevbite opened this issue Apr 18, 2018 · 2 comments
Open

No error is throw when exit code is not equal to 1 #54

kevbite opened this issue Apr 18, 2018 · 2 comments

Comments

@kevbite
Copy link

kevbite commented Apr 18, 2018

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");
    });
@SharpeRAD
Copy link
Owner

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 👍

@kevbite
Copy link
Author

kevbite commented Apr 22, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants