MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createLogCapture

Function createLogCapture

src/utils/xcodebuild-log-capture.ts:43–80  ·  view source on GitHub ↗
(toolName: string)

Source from the content-addressed store, hash-verified

41}
42
43export function createLogCapture(toolName: string): LogCapture {
44 const logDir = resolveWritableLogDir();
45 scheduleArtifactCreatedSweep(logDir);
46 const logPath = path.join(logDir.path, generateLogFileName(toolName));
47 let fd: number | null = null;
48
49 function ensureOpen(): number {
50 if (fd !== null) {
51 return fd;
52 }
53 fd = fs.openSync(logPath, 'wx');
54 return fd;
55 }
56
57 return {
58 write(chunk: string): void {
59 if (chunk.length === 0) {
60 return;
61 }
62 fs.writeSync(ensureOpen(), chunk);
63 },
64 get path(): string {
65 return logPath;
66 },
67 close(): void {
68 if (fd === null) {
69 return;
70 }
71 try {
72 fs.closeSync(fd);
73 } catch {
74 // already closed
75 } finally {
76 fd = null;
77 }
78 },
79 };
80}
81
82export interface ParserDebugCapture {
83 addUnrecognizedLine(line: string): void;

Callers 2

createXcodebuildPipelineFunction · 0.90

Calls 3

resolveWritableLogDirFunction · 0.85
generateLogFileNameFunction · 0.85

Tested by

no test coverage detected