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

Function runNext

src/cli/commands/upgrade.ts:376–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 });

Callers 1

Calls 2

resolveFunction · 0.85
cleanupFunction · 0.70

Tested by

no test coverage detected