You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] set -e still fires inside a function/group/eval body called from a tested context (f || handler) #259
Bash disables errexit for the whole body of a command that runs on the left of ||/&&, after !, or as an if/while condition:
in-f
after
and
in-grp
after
Actual Behavior
Function: prints caught, after: the body stops at false.
Brace group: prints nothing and exits 1: the || handler never runs.
The tested flag that suppresses errexit (src/exec.rs:2181) isn't carried into function, group, eval or source bodies.
Additional Context
#207 tracks this area. #232 makes assignment-only commands return their substitution's status, which is correct, but it means this bug now also hits the common x=$(cmd) shape. These scripts worked on main only because the assignment always returned 0:
set -e; f() { x=$(false); echo in-f; }; f || echo caught # bash: in-f | with #232: caught
set -e; { x=$(false); echo in-grp; } || echo caught # bash: in-grp | with #232: no output, rc=1
Possible Solution
Carry the tested-context state into nested execution (function calls, { }, ( ), eval, .), so errexit is suppressed for the whole body, not just the top-level item.
Activity
test: reproduce strands-agents#259 review findings (child sh, capture…