Repository navigation
fix(interpreter): named file descriptors ({var}>file) and <> like bash - #2624
Merged
Merged
Conversation
…named-fd spec cases
…ite_redirect_opens_file
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 6adc852 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 01:45 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
Named file descriptors now behave like bash 5.2:
{var}works with every redirect form (>,<,>>,<>,<<<,<<,>&N,<&N) on any simple or compound command, and the fd stays open afterwards.{var}>&-closes the fd, and a closed fd is reused.>&N/<&Nto a closed fd printsBad file descriptorwith status 1; a dup to a word printsambiguous redirect.10>x),<>andN<<<word, anddeclare -fprints{var}redirects back.execapplies its redirects in order and no longer applies them a second time, which fixesexec 1>&3 3>&-.Fds stay virtual and per interpreter; no host fds are touched.
Why
BashBox corpus batch: all 17 skipped cases in
bashbox-named-fd.test.shnow pass, plusreadwrite_redirect_opens_file(<>used to be a parse error).Before / After
exec {fd}>f; echo $fd; echo hi >&$fd; exec {fd}>&-; cat f; echo x {o}>g; echo $o; echo hi >&9; echo rc=$?Risk
exec.v=-1and allocates fd 10, so the old tests expecting "invalid file descriptor" were replaced. The fd cap (max_file_descriptors) still applies and has a new test.limitations.md(no shared position forN<>file,3<filealso feeds stdin, output to fds 3-9 from a command's own redirect is dropped).Checklist
Generated by Claude Code