Skip to content

fix(interpreter): check errexit_suppressed in execute_script_body#884

Open
chaliy wants to merge 1 commit intomainfrom
fix/issue-873-errexit-and-or-chain
Open

fix(interpreter): check errexit_suppressed in execute_script_body#884
chaliy wants to merge 1 commit intomainfrom
fix/issue-873-errexit-and-or-chain

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

Summary

  • set -e incorrectly exited when a for/while/until loop body ended with [[ test ]] && cmd returning non-zero
  • Check result.errexit_suppressed in execute_script_body for both errexit and ERR trap suppression
  • Add test set_e_and_chain_at_end_of_for_body reproducing the exact issue scenario

Test plan

  • New test set_e_and_chain_at_end_of_for_body passes
  • All 10 set -e tests pass (including negative tests)
  • Full cargo test --all-features passes
  • cargo fmt --check and cargo clippy clean

Closes #873

set -e incorrectly exited when a for/while/until loop body ended with
an AND-OR chain (e.g. [[ test ]] && cmd) that returned non-zero.

Check result.errexit_suppressed in execute_script_body to suppress
errexit for compound commands whose non-zero exit came from && or ||.

Closes #873
@chaliy chaliy force-pushed the fix/issue-873-errexit-and-or-chain branch from 4039d7a to 97078b6 Compare March 28, 2026 00:10
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.

set -e incorrectly triggers on compound commands whose body ends with && chain failure

1 participant