Repository navigation
fix(interpreter): model bash fork suppression for $SHLVL - #2636
Merged
Merged
Conversation
bash execs the last simple command of a -c string, $( ) body, ( ) or <( ) body, and any simple command run with &, in place; a shell started there lowers SHLVL first and keeps the level. exec bash does too, except directly inside ( ). Child shells no longer inherit trap handlers.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 37bef7f | Commit Preview URL Branch Preview URL |
Oct 08 2026, 09:01 AM |
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
$SHLVLfollows bash's fork suppression: when bash would run a command in place (last simple command of abash -cstring, of( ),$( ),<( ), a background simple command, orexec bashoutside( )), abash/shchild keeps the parent's level instead of adding one.{ }groups, pipelines,if/case, functions, commands with redirects (outside a sole-command subshell), or when an EXIT/ERR/signal trap is set in that shell.bash/shchildren no longer inherit the parent's trap handlers (only ignored signals), sobash -c 'trap "echo bye" EXIT; bash -c true'printsbyeonce.Why
Level-up roadmap, fidelity step: closes the
shlvl-nestingbash-oracle gap (was L-PROC-003).Before / After (verified)
bash-oracle: match 101 → 102, strict 99 → 100 / 106.
floor.txtraised to102 100.1 1 2 bye1 1 2 bye2for the first line;byeprinted twiceRisk
.awaitpoints in the hot path; stack fordepth_32_no_stack_overflowis unchanged vs main (1849 KiB both).printenv SHLVL) still see the unlowered value;env bash/timeout bashin place are not lowered; aSHLVL=nprefix on the in-place command wins over bash's lowering.Checklist
shlvl.test.sh, 7 cases), verified against bash 5.2Generated by Claude Code