MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / captureChildOutput

Function captureChildOutput

packages/simdeck-test/src/index.ts:830–841  ·  view source on GitHub ↗
(child: ChildProcess)

Source from the content-addressed store, hash-verified

828}
829
830function captureChildOutput(child: ChildProcess): () => string {
831 const chunks: string[] = [];
832 const append = (source: string, chunk: Buffer) => {
833 chunks.push(`[${source}] ${chunk.toString("utf8")}`);
834 while (chunks.join("").length > 16_384) {
835 chunks.shift();
836 }
837 };
838 child.stdout?.on("data", (chunk: Buffer) => append("stdout", chunk));
839 child.stderr?.on("data", (chunk: Buffer) => append("stderr", chunk));
840 return () => chunks.join("").trim();
841}
842
843async function freePortPair(): Promise<number> {
844 for (let attempt = 0; attempt < 100; attempt += 1) {

Callers 1

startIsolatedServiceFunction · 0.85

Calls 1

appendFunction · 0.85

Tested by

no test coverage detected