MCPcopy Create free account
hub / github.com/NomicFoundation/hardhat / runPostProcess

Function runPostProcess

scripts/profiler/main.ts:453–473  ·  view source on GitHub ↗

Runs a post-processing shell pipeline; returns whether it succeeded.

(pipeline: string)

Source from the content-addressed store, hash-verified

451
452/** Runs a post-processing shell pipeline; returns whether it succeeded. */
453function runPostProcess(pipeline: string): boolean {
454 // The pipelines write their data to files themselves, so only stderr —
455 // which carries the diagnosis on failure — is captured. perf can emit
456 // megabytes of non-fatal stderr noise even on success, so the buffer is
457 // sized well above the default to not kill a healthy pipeline.
458 const result = spawnSync("bash", ["-c", pipeline], {
459 stdio: ["ignore", "ignore", "pipe"],
460 encoding: "utf-8",
461 maxBuffer: 16 * 1024 * 1024,
462 });
463
464 if (result.status !== 0) {
465 logWarning(
466 `post-processing failed (exit ${String(result.status)}): ${pipeline}\n` +
467 ` ${stderrTail(result.stderr)}`,
468 );
469 return false;
470 }
471
472 return true;
473}
474
475/**
476 * The last few stderr lines of a failed command, as an indented block for a

Callers 1

profileSystemFunction · 0.85

Calls 2

logWarningFunction · 0.90
stderrTailFunction · 0.85

Tested by

no test coverage detected