MCPcopy
hub / github.com/callstack/agent-device / captureStdout

Function captureStdout

src/__tests__/cli-client-commands.test.ts:1031–1046  ·  view source on GitHub ↗
(run: () => Promise<void>)

Source from the content-addressed store, hash-verified

1029});
1030
1031async function captureStdout(run: () => Promise<void>): Promise<string> {
1032 let stdout = '';
1033 const originalWrite = process.stdout.write.bind(process.stdout);
1034 (process.stdout as any).write = ((chunk: unknown) => {
1035 stdout += String(chunk);
1036 return true;
1037 }) as typeof process.stdout.write;
1038
1039 try {
1040 await run();
1041 } finally {
1042 process.stdout.write = originalWrite;
1043 }
1044
1045 return stdout;
1046}
1047
1048async function captureOutput(
1049 run: () => Promise<void>,

Callers 1

Calls 1

runFunction · 0.50

Tested by

no test coverage detected