Repository navigation
fix(interpreter): route builtin, command-not-found and $(...) stderr like bash - #2634
Merged
Merged
Conversation
…like bash - A command's own failure honors its redirects: nocmd 2>/dev/null, ./missing 2>/dev/null, return 2>&1 and source/./getopts/builtin usage errors. - Stderr written inside $(...) reaches the outer stderr, ahead of the expanding command's own and outside its redirects; $(< missing) reports. - eval counts $LINENO and diagnostics from the eval's own line. - exit uses $? with no argument, rejects non-numeric arguments (status 2) and treats extra arguments as a line-discarding error. - /proc refuses new entries like procfs (ENOENT); mkdir/touch print the strerror text. bash-oracle: match 98 -> 101, strict 89 -> 94 (with main).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 8e57fca | Commit Preview URL Branch Preview URL |
Oct 08 2026, 06:36 AM |
… use The coverage build overflowed depth_32_no_stack_overflow. The new await for `"" 2>/dev/null` in execute_simple_command grew its frame; the null command now makes one boxed await for both cases. Held `$(...)` stderr lives on the interpreter instead of in async locals, and own-error redirects go through the boxed redirect_result. Debug stack for the test: main 2.007 MB, before 2.056 MB, now 1.903 MB.
Contributor
Author
|
Generated by Claude Code |
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
Error output now goes where bash sends it.
nocmd 2>/dev/null,./missing 2>/dev/null,return 2>&1, and the usage errors ofsource/./getopts/builtin.$(...)reaches the outer stderr (it was dropped), ahead of the expanding command's own stderr;$(< missing)reports the missing file.evalkeeps the caller's$LINENOand diagnostic line.exitwith no argument uses$?;exit abcreportsnumeric argument requiredand exits 2;exit 1 2reportstoo many arguments./procrefuses new files like procfs (No such file or directory), unless the embedder's own filesystem provides that directory.mkdir/touchprint plain error text instead ofio error: ....Why
Agents read stderr to see what failed. A lost
$(nocmd)error hides the cause; a2>/dev/nullthat does not silence "command not found" pollutes output the script meant to suppress; a write to/proc/xthat succeeds hides a mistake a real OS would report.Before / After
Same script through bashkit (after) and bash 5.2:
Before: line 1's error was missing, line 2 printed
command not found,evalprinted1, and the/procwrite succeeded withrc=0.bash-oracle (106 cases): match 98 → 101, strict 89 → 94; floors raised.
Risk
Stderr from command substitutions is new output; it is capped at
max_stderr_bytesand held per interpreter, so tenants stay isolated.exit abcnow exits 2 instead of 0. Remaining gaps are inknowledge/operations/limitations.md("Stderr routing"):{ a; b; } 2>&1orders merged stderr after the group's stdout; multi-lineevalline counting.Checklist
tests/integration/stderr_fidelity_tests.rs(8),spec_cases/bash/stderr-redirect-fidelity.test.sh(18, compared with real bash), rootfs/flow unit tests-D warnings, integration (1447), lib (2940), bashkit-cli,bash_comparison --ignoredGenerated by Claude Code