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

Ensure powershell scripts fail when executable fails #633

Conversation

jeremiahsnapp
Copy link
Contributor

@jeremiahsnapp jeremiahsnapp commented Sep 12, 2019

We have to explicitly test the exit status after running executables because powershell doesn't automatically fail when an executable's exit status is non-zero.

We've deployed these changes to our own Windows Buildkite packer template and it really increases the confidence that the powershell scripts haven't silently failed.

We have to explicitly test the exit status after running
executables because powershell doesn't automatically
fail when an executable's exit status is non-zero.

Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
@lox
Copy link
Contributor

lox commented Sep 23, 2019

Ugh, so gross 😢

Are you sure there isn't an alternative?

@tduffield
Copy link
Contributor

tduffield commented Sep 23, 2019

Other than not use Powershell? Not that we've found. We got this guidance from a "Windows expert" (for whatever that's worth). But, for context, think of Powershell as a programming language, not a scripting one. Like golang, you gotta tell it when to exit, and with what error code.

@tduffield
Copy link
Contributor

At least here we don't have to handle nil :trollface:

@lox
Copy link
Contributor

lox commented Oct 24, 2019

Cool, let's merge this in. Is what it is!

@lox lox merged commit 773e397 into buildkite:master Oct 24, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants