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

Function launchSimulatorApp

src/utils/simulator-steps.ts:120–141  ·  view source on GitHub ↗
(
  simulatorId: string,
  bundleId: string,
  executor: CommandExecutor,
  opts?: { args?: string[]; env?: Record<string, string> },
)

Source from the content-addressed store, hash-verified

118 * Launch an app on a simulator and return the process ID if available.
119 */
120export async function launchSimulatorApp(
121 simulatorId: string,
122 bundleId: string,
123 executor: CommandExecutor,
124 opts?: { args?: string[]; env?: Record<string, string> },
125): Promise<LaunchStepResult> {
126 log('info', `Launching app with bundle ID: ${bundleId} on simulator: ${simulatorId}`);
127 const command = ['xcrun', 'simctl', 'launch', simulatorId, bundleId];
128 if (opts?.args?.length) {
129 command.push(...opts.args);
130 }
131
132 const execOpts = opts?.env ? { env: normalizeSimctlChildEnv(opts.env) } : undefined;
133 const result = await executor(command, 'Launch App', false, execOpts);
134 if (!result.success) {
135 return { success: false, error: result.error ?? 'Failed to launch app' };
136 }
137
138 const pidMatch = result.output?.match(/:\s*(\d+)\s*$/);
139 const processId = pidMatch ? parseInt(pidMatch[1], 10) : undefined;
140 return { success: true, processId };
141}
142
143export type ProcessSpawner = (
144 command: string,

Callers

nothing calls this directly

Calls 4

logFunction · 0.90
normalizeSimctlChildEnvFunction · 0.90
pushMethod · 0.80
executorFunction · 0.50

Tested by

no test coverage detected