Repository navigation
fix(interpreter): exec N>&- closes the descriptor for real - #2610
Merged
Merged
Conversation
A write to a descriptor closed with `exec 1>&-` was still printed and still succeeded. It now behaves like bash: the data is dropped, the command reports `write error: Bad file descriptor` under its own name, and its status is 1. A closed fd 2 swallows the report but keeps the status. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 4b32ac3 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 10:59 PM |
10 tasks done
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
exec 1>&-andexec 2>&-now close the descriptor instead of quietlyreverting to the caller's stream. A later write to a closed descriptor is
dropped, the command reports
write error: Bad file descriptorunder its ownname, and its status is 1. When fd 2 is closed too, the report is swallowed but
the status still fails.
Why
Scripts use
exec 1>&-to prove nothing writes to stdout afterwards. Bashkitprinted the output and succeeded, so such a script passed in bashkit and failed
in bash.
Before / After
Script:
line 2: echo: write error: Bad file descriptorxbash: line 2: echo: write error: Bad file descriptor(bash names the script path where bashkit says
bash:; the interpreter does nottrack a script path, which is a separate known gap.)
Risk
Low. Confined to the exec fd table: a new
FdTarget::Closedvariant that onlyexec N>&-produces. Everything else routes as before.L-PROC-001 now also records that an
execredirect inside a subshell or abash -cchild does not take effect, since only the outermost command looproutes the exec fd table. That is pre-existing behavior, found while testing
this, and not changed here.
Checklist
cargo test -p bashkit --lib(2859 passed)cargo test -p bashkit --test integration(1355 passed)bash_comparisondifferential tests against real bashcargo clippy -p bashkit --all-targets -- -D warningscargo fmt --all --checkcargo test -p bashkit-cli(56 passed)just check-okf,just check-doc-linkslog.md,limitations.md)https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code