Skip to content

fix(interpreter): set -e respects AND-OR lists in functions and loops#824

Merged
chaliy merged 1 commit intomainfrom
fix/issue-807-set-e-and-list
Mar 26, 2026
Merged

fix(interpreter): set -e respects AND-OR lists in functions and loops#824
chaliy merged 1 commit intomainfrom
fix/issue-807-set-e-and-list

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

Summary

  • Fix set -e incorrectly exiting on [[ cond ]] && cmd inside functions, brace groups, and loops
  • Skip errexit in execute_command_sequence_impl for Command::List with &&/|| operators
  • Remove redundant errexit checks in for/while/until loop bodies

Test plan

  • set_e_and_list_in_function[[ false ]] && return 0 in function
  • set_e_and_list_in_brace_group[[ false ]] && echo in { } > file
  • set_e_and_list_in_for_loop[[ false ]] && return 0 in for loop
  • set_e_and_list_top_level — top-level AND-OR still works
  • set_e_exits_on_plain_failurefalse still exits under set -e
  • Full test suite passes

Closes #807

Closes #807 — `set -e` no longer incorrectly exits when `[[ cond ]] && cmd`
has a false condition inside functions, brace groups, or for/while/until loops.

Root cause: execute_command_sequence_impl and loop bodies had redundant
errexit checks that didn't account for AND-OR list context. Fix:
1. Skip errexit in sequence executor for Command::List with && or || operators
2. Remove redundant errexit checks in for/while/until loop bodies
@chaliy chaliy merged commit 3bc78f7 into main Mar 26, 2026
18 of 23 checks passed
@chaliy chaliy deleted the fix/issue-807-set-e-and-list branch March 26, 2026 13:25
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.

fix: set -e incorrectly exits on [[ ]] && cmd inside { } > file

1 participant