Problem
The sandboxed PHP spawn handler starts piping child stdout and stderr, then calls processApi.exit() after result.exitCode without awaiting either pipeTo() promise. A sufficiently large child response can therefore close the parent-facing streams before their tails are delivered.
This was reproduced with a PHPUnit subprocess that completed 693/695 tests but lost its final test and summary output. A focused 1 MiB subprocess probe verifies the generic contract.
Root cause
In packages/php-wasm/universal/src/lib/sandboxed-spawn-handler-factory.ts, the PHP branch creates stdout/stderr pipeTo() promises but does not await them before processApi.exit().
Acceptance criteria
- The PHP subprocess exit status is retained.
- Both stdout and stderr are fully drained before the parent-facing process exits.
- A large-output regression verifies the final tail bytes in Asyncify and JSPI.
Related, already tracked
Bare child php also needs stdin forwarded into PHP.cli(). That owning API gap is already tracked by #3519 and implemented in open PR #3523; it is intentionally outside this issue.
Problem
The sandboxed PHP spawn handler starts piping child stdout and stderr, then calls
processApi.exit()afterresult.exitCodewithout awaiting eitherpipeTo()promise. A sufficiently large child response can therefore close the parent-facing streams before their tails are delivered.This was reproduced with a PHPUnit subprocess that completed 693/695 tests but lost its final test and summary output. A focused 1 MiB subprocess probe verifies the generic contract.
Root cause
In
packages/php-wasm/universal/src/lib/sandboxed-spawn-handler-factory.ts, the PHP branch creates stdout/stderrpipeTo()promises but does not await them beforeprocessApi.exit().Acceptance criteria
Related, already tracked
Bare child
phpalso needs stdin forwarded intoPHP.cli(). That owning API gap is already tracked by #3519 and implemented in open PR #3523; it is intentionally outside this issue.