-
Notifications
You must be signed in to change notification settings - Fork 3
add BashWithOpts command for strict bash exec #45
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instinctively I would want pipe failures to exit with error codes by default. What's the motivation to implement it as a standalone option?
|
Also thank you for picking this up 🚀 |
Co-authored-by: Sander Ginn <sanderginn@users.noreply.github.com>
Co-authored-by: Robert Lin <robert@bobheadxi.dev>
Sorry @sanderginn missed your comment and only saw it now. Forcing it now to run with bash strictness might break other scripts so I opted to add it as a separate call. |
In #44 a command seems to not return an error from a command that is executed. Upon further investigation it is because the command is executed with
bash -c, which means bash default options which means that if the last command of a pipe succeeds, the entire pipe statement is considered to have succeeded regardless if earlier statements have failed. A common "fix" for this is to enablepipefailanderrexitoptions in bash.This PR adds easier way for users to execute some bash scripts with "strict" bash and possibly avoid unexpected errors.
Closes #44