From 2b291e12b790b5f165d56da0b8e259ef7a1d1eb9 Mon Sep 17 00:00:00 2001 From: Michel Paulissen <862400+MichelPaulissen@users.noreply.github.com> Date: Sat, 4 Jul 2026 17:47:40 +0200 Subject: [PATCH] Sync public tree to cba0ec1 --- DISASMER_PUBLIC_TREE.json | 4 +-- scripts/cli-happy-path-live-smoke.js | 48 ++++++++++++++++++---------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/DISASMER_PUBLIC_TREE.json b/DISASMER_PUBLIC_TREE.json index f6a802c..605e0dc 100644 --- a/DISASMER_PUBLIC_TREE.json +++ b/DISASMER_PUBLIC_TREE.json @@ -1,7 +1,7 @@ { "kind": "disasmer-filtered-public-tree", - "source_commit": "b67d2a61d1b2a7600593024b4943e155443eb1d7", - "release_name": "dryrun-b67d2a61d1b2", + "source_commit": "cba0ec1babb581e7e75ad49a57e3cc8c9269d9da", + "release_name": "dryrun-cba0ec1babb5", "filtered_out": [ "private/**", "experiments/**", diff --git a/scripts/cli-happy-path-live-smoke.js b/scripts/cli-happy-path-live-smoke.js index 113810b..6aa3ad4 100644 --- a/scripts/cli-happy-path-live-smoke.js +++ b/scripts/cli-happy-path-live-smoke.js @@ -76,12 +76,31 @@ function run(command, args, options = {}) { function runJson(command, args, options = {}) { const output = run(command, args, options); - const line = output - .trim() - .split(/\r?\n/) - .filter(Boolean) - .at(-1); - return JSON.parse(line); + return parseJsonOutput(output); +} + +function parseJsonOutput(output) { + const trimmed = output.trim(); + if (!trimmed) { + throw new Error("expected JSON output, got empty stdout"); + } + try { + return JSON.parse(trimmed); + } catch (_) { + // Commands may print progress before their final JSON report. Try each + // trailing block so both compact and pretty-printed JSON are accepted. + } + + const lines = trimmed.split(/\r?\n/).filter(Boolean); + for (let index = lines.length - 1; index >= 0; index -= 1) { + try { + return JSON.parse(lines.slice(index).join("\n")); + } catch (_) { + // Keep scanning for the start of the trailing JSON value. + } + } + + throw new Error(`could not parse JSON output:\n${trimmed}`); } function executable(root, name) { @@ -120,16 +139,13 @@ function waitForJsonLine(child, label) { }, 120000); child.stdout.on("data", (chunk) => { stdout += chunk.toString(); - for (const line of stdout.split(/\r?\n/)) { - if (!line.trim()) continue; - try { - const parsed = JSON.parse(line); - clearTimeout(timer); - resolve(parsed); - return; - } catch (_) { - // keep waiting - } + try { + const parsed = parseJsonOutput(stdout); + clearTimeout(timer); + resolve(parsed); + return; + } catch (_) { + // Keep waiting for a complete JSON value. } }); child.stderr.on("data", (chunk) => {