Repository navigation
feat(stdlib/bun): bun_run_capture β captured child-process run #781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,19 @@ try { | |
| throw new Error("missing environment value failed"); | ||
| } | ||
| if (subject.run_successful_child() !== 0) throw new Error("subprocess lowering failed"); | ||
| // Captured run (bun_run_capture): planted controls with known answers. | ||
| const captured = subject.run_captured("echo hi; echo err >&2; exit 3", ""); | ||
| if (captured.status !== 3) throw new Error(`capture status failed: ${captured.status}`); | ||
| if (captured.stdout !== "hi\n") throw new Error(`capture stdout failed: ${JSON.stringify(captured.stdout)}`); | ||
| if (captured.stderr !== "err\n") throw new Error(`capture stderr failed: ${JSON.stringify(captured.stderr)}`); | ||
| const inDir = subject.run_captured("pwd", nested); | ||
| if (inDir.status !== 0 || inDir.stdout.trim() !== nested) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π― Functional Correctness | π Major | β‘ Quick win Compare resolved working-directory paths. On macOS, Proposed path comparison--- "a/tests/codegen-bun/host_profile.harness.mjs"
+++ "b/tests/codegen-bun/host_profile.harness.mjs"
@@ -30,7 +30,7 @@
if (captured.stdout !== "hi\n") throw new Error(`capture stdout failed: ${JSON.stringify(captured.stdout)}`);
if (captured.stderr !== "err\n") throw new Error(`capture stderr failed: ${JSON.stringify(captured.stderr)}`);
const inDir = subject.run_captured("pwd", nested);
- if (inDir.status !== 0 || inDir.stdout.trim() !== nested) {
+ if (inDir.status !== 0 || realpathSync(inDir.stdout.trim()) !== realpathSync(nested)) {
throw new Error(`capture cwd failed: ${JSON.stringify(inDir)}`);
}
const missing = subject.run_missing_program();Import π€ Prompt for AI Agents |
||
| throw new Error(`capture cwd failed: ${JSON.stringify(inDir)}`); | ||
| } | ||
| const missing = subject.run_missing_program(); | ||
| if (missing.status !== 1 || !missing.stderr.includes("affinescript-no-such-program")) { | ||
| throw new Error(`capture spawn-error failed: ${JSON.stringify(missing)}`); | ||
| } | ||
| subject.remove_path(file); | ||
| let missingPathThrew = false; | ||
| try { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ποΈ Data Integrity & Integration | π Major | β‘ Quick win
π Supported by static analysis
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 6327
π Web query:
Bun v1.3.14 child_process spawnSync ENOBUFS maxBuffer status error implementationπ‘ Result:
π Web query:
Bun v1.3.14 source exitedDueToMaxBuffer spawnSync exitCode native implementationπ‘ Result:
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 7901
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 21212
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 16781
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 16671
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 6785
π Script executed:
Repository: hyperpolymath/affinescript
Length of output: 37004
Give host errors precedence over the child status.
When Bun detects a max-buffer overflow after the child has already exited with status
0,__r.errorcan be present while__r.statusremains0. This returns incomplete output as a successfulbun_run_captureresult.π Suggested fix
π€ Prompt for AI Agents