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

Function resolveAppPidViaLaunch

src/utils/simulator-steps.ts:282–300  ·  view source on GitHub ↗
(
  simulatorUuid: string,
  bundleId: string,
  executor: CommandExecutor,
)

Source from the content-addressed store, hash-verified

280}
281
282async function resolveAppPidViaLaunch(
283 simulatorUuid: string,
284 bundleId: string,
285 executor: CommandExecutor,
286): Promise<number | undefined> {
287 // simctl launch is idempotent: calling it on an already-running app
288 // returns the existing PID without relaunching.
289 const result = await executor(
290 ['xcrun', 'simctl', 'launch', simulatorUuid, bundleId],
291 'Resolve App PID',
292 false,
293 );
294 if (!result.success) {
295 log('warn', `Failed to resolve app PID: ${result.error ?? result.output}`);
296 return undefined;
297 }
298 const pidMatch = result.output?.match(/:\s*(\d+)\s*$/);
299 return pidMatch ? parseInt(pidMatch[1], 10) : undefined;
300}
301
302function stopDetachedHelper(child: ChildProcess): void {
303 try {

Callers 1

Calls 2

logFunction · 0.90
executorFunction · 0.50

Tested by

no test coverage detected