fix: parse stdout, not stdall, in ProcessOutput.json() - #1506
Open
lukiod wants to merge 1 commit into
Open
Conversation
`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.
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.
Fixes #1505.
json()ranJSON.parseonstdall(the combined stdout+stderr stream), so a well-behaved CLI that writes JSON to stdout and progress/prompts to stderr would breakjson()even though stdout alone contains valid JSON, matching the repro in the issue.Fix: parse
stdoutinstead.stdoutis already tracked separately onProcessOutput, so no new plumbing is needed.The existing
json()unit test happened to construct its fixture with the JSON payload in thestdallparam and an emptystdout, which only worked because it was exercising the same bug this PR fixes — updated it to put the JSON instdout, and added a new test that reproduces the issue's exact combined-stream scenario (JSON in stdout, unrelated text in stderr) and confirmsjson()now parses correctly. Verified the new test fails against the unpatched code and passes with the fix; fullcore.test.jssuite (134 tests) passes.