Repository navigation
fix(interpreter): run coprocesses concurrently over in-process pipes - #2638
Merged
Merged
Conversation
coproc bodies ran once at `coproc` with empty stdin, so writes to
${NAME[1]} were lost (bash-oracle coproc-basic printed an empty line).
A coproc is now a background job wired to the shell through two bounded
pipes: writes feed its stdin, closing the write end delivers EOF, reads
of ${NAME[0]} take its output line by line. bash fd numbering, the
still-exists warning, NAME/NAME_PID cleanup after wait, and exec()
closing the shell's ends before waiting for jobs.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 19c5074 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 10:14 AM |
3 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
coprocruns its body as a background job alongside the shell, connected by two bounded in-process pipes (the same pipes pipeline stages use). Writes to${NAME[1]}feed its stdin, closing the write end delivers EOF, reads from${NAME[0]}get its output.read -u,wait $NAME_PID(returns the body's status),$!,jobs, the default nameCOPROC, bash's fd numbers (63 60) and the "still exists" warning match bash.waitreaps a coproc, NAME/NAME_PID are unset and its fds closed.exec()closes unclosed coprocs so a call can't hang.<&$xwith an empty$xis now an error instead of silently reading stdin.Why
Level-up roadmap, concurrency/streaming step: closes the
coproc-basicbash-oracle gap.Before / After (verified)
bash-oracle: match 102 → 103, strict 100 → 101 / 106.
floor.txtraised to103 101.coproc-basic(coproc UPPER { tr a-z A-Z; }, write, close, read): main printed an empty line, bash and this branch printTEXTO.bash 5.2 and this branch:
got q1/got q2/rc=0.Risk
concurrent_jobs(false)the body runs to completion atcoprocwith stdin at EOF.depth_32_no_stack_overflowis identical to main.wait(bash reaps on SIGCHLD); a coproc fd as a compound command's stdin is read up front;read -non a coproc fd consumes the whole line; writes after exit are dropped instead of SIGPIPE.Checklist
coproc_tests.rs), verified against bash 5.2Generated by Claude Code