Repository navigation
Description
What I did
On macOS arm64, I ran the existing tests/io/process_run.bend fixture against the source interpreter, emitted JS, and a native binary built from main at a3b0dfe:
BEND_NO_TELEMETRY=1 bun bend2/main.ts tests/io/process_run.bend
BEND_NO_TELEMETRY=1 bun bend2/main.ts tests/io/process_run.bend -o /tmp/process-run.js
bun /tmp/process-run.js
BEND_NO_TELEMETRY=1 bun bend2/main.ts tests/io/process_run.bend -o /tmp/process-run-native
/tmp/process-run-nativeI repeated the interpreter check with Bun 1.4.0 and 1.4.2. The subsequent main commit 1159f0b does not change process_run.js, process_run.c, this fixture, or the guide's contract.
What happened
The native binary prints the fixture's expected output (all 16 checks are True). Both the interpreter and emitted JS disagree on the two descendant cases:
expected: inherited pipe: True
actual: inherited pipe: unexpected failure
expected: descendant output: True
actual: descendant output: unexpected failure
The first case is Process.run("/bin/sh", ["-c", "sleep 3 & echo hi"], "", 128, 1500) in the existing fixture. A direct Bun.spawnSync probe for that command returned exitCode: 0 and exitedDueToTimeout: true after about 1500 ms, with stdout: "hi\n". That is consistent with the inherited pipe remaining open after the direct child exits; I have not determined which part of Bun's process lifecycle sets the timeout flag. The yes & echo hi case is also observed failing here, but its output volume is scheduling-sensitive, so the sleep case is the cleaner regression.
process_run.js currently maps exitedDueToTimeout to Fail. The guide says a descendant holding an inherited pipe open does not extend Process.run's wait. Since gates/test.ts compares this fixture in interpreter, C, and JS lanes, the observed JS output disagrees with the checked-in expectation.
Prior work / question
#1051 reported the opposite mismatch (C failed where JS succeeded), and #1054 changed the native path. Its review already noted Linux/Bun differences; this report adds a macOS reproduction of the remaining JS-side mismatch. I did not find an open issue or PR that changes process_run.js for this case.
Should the JS lane keep the documented direct-child behavior here? If so, I would treat this as a process-lifecycle fix plus a focused regression, not as a reason to relax the fixture's expectation. I have not proposed a patch yet because swapping process APIs or changing timeout handling without agreeing on the intended behavior could create new leaks or hangs.
Environment
- Bend: 2.0.35
- Bun: 1.4.0 and 1.4.2
uname -sm:Darwin arm64- Clang:
Apple clang version 17.0.0 (clang-1700.4.4.1)
Activity