fix(interpreter): propagate errexit_suppressed through compound commands#868
Merged
fix(interpreter): propagate errexit_suppressed through compound commands#868
Conversation
76009ba to
30c6116
Compare
When a loop body's last command is an AND-OR list (e.g. `[[ cond ]] && cmd`) that exits non-zero, the loop should not trigger `set -e` at the caller level. Add `errexit_suppressed` flag to ExecResult. Set it when execute_list returns a non-zero exit from an AND-OR chain. Propagate it through for, while/until, and C-style for loops back to execute_command_sequence_impl, which now skips errexit when the flag is set. Closes #867
30c6116 to
0440c3e
Compare
Add exemptions for cmake 0.1.57, console 0.15.11, insta 1.46.3, simd-adler32 0.3.8, and unicode-segmentation 1.13.1 alongside the existing exemptions for their newer versions. These older versions are in Cargo.lock and need exemptions for cargo-vet to pass in CI.
7855104 to
2493fda
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
errexit_suppressedflag toExecResultto track when a non-zero exit code came from an AND-OR listexecute_listwhen the list has conditional operators (&&/||) and exits non-zeroexecute_for,execute_arithmetic_for, andexecute_condition_loop(while/until)execute_command_sequence_implwhen the flag is setCloses #867
Test plan
set_e_and_list_in_nested_cfor— nested C-style for loops with[[ ]] && cmdset_e_and_list_in_nested_for_in— nested for-in loopsset_e_and_list_in_nested_while— nested while loopsset_e_exits_on_plain_failure_in_nested_loop— plainfalsestill triggers errexitset_e_and_or_testsstill passcargo test --all-features)cargo fmt --checkandcargo clippyclean