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

Enable Bash's inherit_errexit #1655

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Enable Bash's inherit_errexit #1655

merged 1 commit into from
Oct 3, 2024

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Oct 3, 2024

By default Bash subshells (including command substitutions) do not inherit exit on error from the caller. This can cause surprises when functions are called from within command substitutions whose error handling is relying upon exit on error. For example, this cause error handling not to work as expected in the upcoming Python version handling reimplementation.

However, as of Bash 4.4 this can be changed by enabling inherit_errexit. (The oldest Bash on our supported stacks is 5.0.)

See:
https://www.shellcheck.net/wiki/SC2311
https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

GUS-W-16899232.

By default Bash subshells (including command substitutions) do not
inherit exit on error from the caller. This can cause surprises when
functions are called from within command substitutions whose error
handling is relying upon exit on error.

However, as of Bash 4.4 this can be changed by enabling `inherit_errexit`.
(The oldest Bash on our supported stacks is 5.0.)

See:
https://www.shellcheck.net/wiki/SC2311
https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
@edmorley edmorley self-assigned this Oct 3, 2024
@edmorley edmorley marked this pull request as ready for review October 3, 2024 15:27
@edmorley edmorley requested a review from a team as a code owner October 3, 2024 15:27
@edmorley edmorley enabled auto-merge (squash) October 3, 2024 15:28
@edmorley edmorley merged commit 92633fc into main Oct 3, 2024
7 checks passed
@edmorley edmorley deleted the inherit-errexit branch October 3, 2024 16:04
@heroku-linguist heroku-linguist bot mentioned this pull request Oct 9, 2024
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.

2 participants