fix(core): parse stdout in json() (#1505) - #1511
shubhransh-gupta wants to merge 4 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
way to over complicated. |
|
Simplified! Stripped out all option flags and types. |
|
|
Thanks @antongolub, that makes complete sense regarding the contract alignment ( To avoid a breaking change while keeping the implementation minimal (avoiding the overcomplicated options API @antonmedv pointed out), would you prefer keeping json<T = any>(from: 'stdout' | 'stderr' | 'stdall' = 'stdall'): T {
return JSON.parse(this[from])
}This:
Would this work for you? |
|
Updated the implementation in commit 58c5236:
|
Fixes #1505
Problem
ProcessOutput.json()previously parsedthis.stdall. When CLI commands write structured JSON tostdoutwhile logging diagnostic/progress messages tostderr(e.g. Railway CLI viarailway add --json),stdallcontains interleaved text from both streams, causingSyntaxError: Unexpected token ... in JSON at position ....Solution
ProcessOutput.json()now parsesthis.stdoutdirectly:Checklist