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

Function resolveProcessId

src/utils/macos-steps.ts:52–72  ·  view source on GitHub ↗
(
  appName: string,
  executor: CommandExecutor,
)

Source from the content-addressed store, hash-verified

50const MAC_PID_INTERVAL_MS = 100;
51
52async function resolveProcessId(
53 appName: string,
54 executor: CommandExecutor,
55): Promise<number | undefined> {
56 const start = Date.now();
57 while (Date.now() - start < MAC_PID_TIMEOUT_MS) {
58 try {
59 const pgrepResult = await executor(['pgrep', '-x', appName], 'Get Process ID', false);
60 if (pgrepResult.success && pgrepResult.output) {
61 const pid = parseInt(pgrepResult.output.trim().split('\n')[0], 10);
62 if (!isNaN(pid)) {
63 return pid;
64 }
65 }
66 } catch {
67 // not visible yet
68 }
69 await new Promise((resolve) => setTimeout(resolve, MAC_PID_INTERVAL_MS));
70 }
71 return undefined;
72}

Callers 1

launchMacAppFunction · 0.85

Calls 1

executorFunction · 0.50

Tested by

no test coverage detected