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

Function defaultSpawnUpgradeProcess

src/cli/commands/upgrade.ts:372–418  ·  view source on GitHub ↗
(commands: string[][])

Source from the content-addressed store, hash-verified

370// --- Spawn runners ---
371
372function defaultSpawnUpgradeProcess(commands: string[][]): Promise<number> {
373 return new Promise((resolve, reject) => {
374 let currentIndex = 0;
375
376 function runNext(): void {
377 if (currentIndex >= commands.length) {
378 resolve(0);
379 return;
380 }
381
382 const [cmd, ...args] = commands[currentIndex];
383 const child = spawn(cmd, args, { stdio: 'inherit' });
384
385 const forwardSigint = (): void => {
386 child.kill('SIGINT');
387 };
388 const forwardSigterm = (): void => {
389 child.kill('SIGTERM');
390 };
391
392 process.on('SIGINT', forwardSigint);
393 process.on('SIGTERM', forwardSigterm);
394
395 const cleanup = (): void => {
396 process.removeListener('SIGINT', forwardSigint);
397 process.removeListener('SIGTERM', forwardSigterm);
398 };
399
400 child.on('error', (err) => {
401 cleanup();
402 reject(err);
403 });
404
405 child.on('close', (code) => {
406 cleanup();
407 if (code !== 0) {
408 resolve(code ?? 1);
409 return;
410 }
411 currentIndex++;
412 runNext();
413 });
414 }
415
416 runNext();
417 });
418}
419
420// --- Dependency factory ---
421

Callers

nothing calls this directly

Calls 1

runNextFunction · 0.85

Tested by

no test coverage detected