Repository navigation
fix(interpreter): set -e ignored contexts reach functions, subshells, $( ) - #2590
Merged
Merged
Conversation
… $( ) - `! cmd` no longer triggers errexit - conditions and non-final &&/|| elements ignore errexit inside called functions and subshells (depth counter, copied into forked stages) - command substitution clears -e unless inherit_errexit Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 870253a | Commit Preview URL Branch Preview URL |
Oct 07 2026, 07:31 PM |
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.
Requested by Михайло · project thread
What changed
set -enow follows bash's ignored contexts:! cmdnever exits the script.if/while/untilcondition, a non-final&&/||element, or a!pipeline, errexit stays off in everything that context runs, including function bodies and subshells. This uses a depth counter (errexit_active()), and forked pipeline stages copy it.$( )clears-eunlessshopt -s inherit_errexitis set. With that option the substitution stops at its first failure.Why
These are roadmap step 1 fidelity gaps.
set -escripts are common in agent output, and bashkit was stricter than bash.check bad && …,if f; then, andx=$(cmd_that_may_fail; echo default)all aborted scripts that bash runs to the end. Debian-oracle caseserrexit-exceptions,errexit-subshell-and-cmdsubanderrexit-in-function-called-from-andnow match bash.Before / After
set -e)! true; echo okokf() { false; echo in; }; if f; then echo y; fiin,y( false; echo sub ) || echo failedfailedsubx=$(false; echo y); echo $xyshopt -s inherit_errexit; x=$(f; echo more)Proof: new spec
errexit-contexts.test.sh(7 cases, bash-verified), andbash_comparisonpasses.Risk
Low-medium. This changes when scripts stop under
set -e, toward bash. The existing errexit tests (lib, integration, spec) all pass unchanged.Checklist
cargo test -p bashkit --lib/--test integration/bash_comparison-D warnings, fmt,check-okfset -econtexts", loghttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code