Sync public tree to cba0ec1
This commit is contained in:
parent
1d72f20cce
commit
2b291e12b7
2 changed files with 34 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"kind": "disasmer-filtered-public-tree",
|
"kind": "disasmer-filtered-public-tree",
|
||||||
"source_commit": "b67d2a61d1b2a7600593024b4943e155443eb1d7",
|
"source_commit": "cba0ec1babb581e7e75ad49a57e3cc8c9269d9da",
|
||||||
"release_name": "dryrun-b67d2a61d1b2",
|
"release_name": "dryrun-cba0ec1babb5",
|
||||||
"filtered_out": [
|
"filtered_out": [
|
||||||
"private/**",
|
"private/**",
|
||||||
"experiments/**",
|
"experiments/**",
|
||||||
|
|
|
||||||
|
|
@ -76,12 +76,31 @@ function run(command, args, options = {}) {
|
||||||
|
|
||||||
function runJson(command, args, options = {}) {
|
function runJson(command, args, options = {}) {
|
||||||
const output = run(command, args, options);
|
const output = run(command, args, options);
|
||||||
const line = output
|
return parseJsonOutput(output);
|
||||||
.trim()
|
}
|
||||||
.split(/\r?\n/)
|
|
||||||
.filter(Boolean)
|
function parseJsonOutput(output) {
|
||||||
.at(-1);
|
const trimmed = output.trim();
|
||||||
return JSON.parse(line);
|
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) {
|
function executable(root, name) {
|
||||||
|
|
@ -120,16 +139,13 @@ function waitForJsonLine(child, label) {
|
||||||
}, 120000);
|
}, 120000);
|
||||||
child.stdout.on("data", (chunk) => {
|
child.stdout.on("data", (chunk) => {
|
||||||
stdout += chunk.toString();
|
stdout += chunk.toString();
|
||||||
for (const line of stdout.split(/\r?\n/)) {
|
|
||||||
if (!line.trim()) continue;
|
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(line);
|
const parsed = parseJsonOutput(stdout);
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
resolve(parsed);
|
resolve(parsed);
|
||||||
return;
|
return;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// keep waiting
|
// Keep waiting for a complete JSON value.
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
child.stderr.on("data", (chunk) => {
|
child.stderr.on("data", (chunk) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue