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

Function finishShutdown

src/daemon.ts:341–371  ·  view source on GitHub ↗
(finalExitCode: number, flushTimeoutMs: number)

Source from the content-addressed store, hash-verified

339 let cleanupStarted = false;
340 let forcedShutdownTimer: NodeJS.Timeout | null = null;
341 const finishShutdown = (finalExitCode: number, flushTimeoutMs: number): void => {
342 if (cleanupStarted) {
343 return;
344 }
345 cleanupStarted = true;
346 if (forcedShutdownTimer) {
347 clearTimeout(forcedShutdownTimer);
348 forcedShutdownTimer = null;
349 }
350 void cleanupArtifacts()
351 .then(
352 (result) => {
353 if (result.errors.length > 0) {
354 log('error', `[Daemon] Cleanup failed: ${result.errors.join('; ')}`, {
355 sentry: true,
356 });
357 return;
358 }
359 log('info', '[Daemon] Cleanup complete');
360 },
361 (error) => {
362 const message = error instanceof Error ? error.message : String(error);
363 log('error', `[Daemon] Cleanup failed: ${message}`, { sentry: true });
364 },
365 )
366 .finally(() => {
367 void flushAndCloseSentry(flushTimeoutMs).finally(() => {
368 process.exit(finalExitCode);
369 });
370 });
371 };
372
373 forcedShutdownTimer = setTimeout(() => {
374 log('warn', '[Daemon] Forced shutdown after timeout');

Callers 1

shutdownFunction · 0.85

Calls 3

logFunction · 0.90
flushAndCloseSentryFunction · 0.90
cleanupArtifactsFunction · 0.85

Tested by

no test coverage detected