MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / scanStdoutForTerminalResult

Function scanStdoutForTerminalResult

src/benchmarks/claude-ui/harness.ts:393–408  ·  view source on GitHub ↗
(chunk: Buffer)

Source from the content-addressed store, hash-verified

391 }
392
393 const scanStdoutForTerminalResult = (chunk: Buffer): void => {
394 if (opts.terminalJsonResultGraceMs === undefined || terminalResultExitCode !== undefined)
395 return;
396 stdoutBuffer += chunk.toString('utf8');
397 const lines = stdoutBuffer.split('\n');
398 stdoutBuffer = lines.pop() ?? '';
399 for (const line of lines) {
400 if (line.trim().length === 0) continue;
401 try {
402 const record = JSON.parse(line) as StreamJsonResult;
403 if (record.type === 'result') recordTerminalResult(record);
404 } catch {
405 // Claude stream-json records are newline-delimited JSON. Ignore non-JSON fragments.
406 }
407 }
408 };
409
410 child.stdout.on('data', (chunk: Buffer) => {
411 if (settled) return;

Callers 1

runCommandFunction · 0.85

Calls 1

recordTerminalResultFunction · 0.85

Tested by

no test coverage detected