Skip to content

fix: parse stdout, not stdall, in ProcessOutput.json() - #1506

Open
lukiod wants to merge 1 commit into
google:mainfrom
lukiod:fix-json-parses-stdall
Open

fix: parse stdout, not stdall, in ProcessOutput.json()#1506
lukiod wants to merge 1 commit into
google:mainfrom
lukiod:fix-json-parses-stdall

Conversation

@lukiod

@lukiod lukiod commented Aug 19, 2026

Copy link
Copy Markdown

Fixes #1505.

json() ran JSON.parse on stdall (the combined stdout+stderr stream), so a well-behaved CLI that writes JSON to stdout and progress/prompts to stderr would break json() even though stdout alone contains valid JSON, matching the repro in the issue.

Fix: parse stdout instead. stdout is already tracked separately on ProcessOutput, so no new plumbing is needed.

The existing json() unit test happened to construct its fixture with the JSON payload in the stdall param and an empty stdout, which only worked because it was exercising the same bug this PR fixes — updated it to put the JSON in stdout, and added a new test that reproduces the issue's exact combined-stream scenario (JSON in stdout, unrelated text in stderr) and confirms json() now parses correctly. Verified the new test fails against the unpatched code and passes with the fix; full core.test.js suite (134 tests) passes.

`json()` ran JSON.parse on stdall (the combined stdout+stderr
stream), so a well-behaved CLI that writes JSON to stdout and
progress/prompts to stderr would break json() even though stdout
alone contains valid JSON. Parse stdout instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcessOutput.json() parses combined stdout+stderr, breaking on CLIs that log progress to stderr

1 participant