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

Function ensureDaemonRunning

src/cli/daemon-control.ts:201–229  ·  view source on GitHub ↗
(opts: EnsureDaemonRunningOptions)

Source from the content-addressed store, hash-verified

199 * This is the main entry point for auto-start behavior.
200 */
201export async function ensureDaemonRunning(opts: EnsureDaemonRunningOptions): Promise<void> {
202 const client = new DaemonClient({ socketPath: opts.socketPath });
203 const timeoutMs = opts.startupTimeoutMs ?? DEFAULT_DAEMON_STARTUP_TIMEOUT_MS;
204
205 const isRunning = await client.isRunning();
206 if (isRunning) {
207 try {
208 await client.status();
209 return;
210 } catch (error) {
211 if (error instanceof DaemonVersionMismatchError) {
212 await forceStopDaemon(opts.socketPath);
213 } else {
214 return;
215 }
216 }
217 }
218
219 startDaemonBackground({
220 socketPath: opts.socketPath,
221 workspaceRoot: opts.workspaceRoot,
222 env: opts.env,
223 });
224
225 await waitForDaemonReady({
226 socketPath: opts.socketPath,
227 timeoutMs,
228 });
229}
230
231export interface StartDaemonForegroundOptions {
232 socketPath: string;

Callers 2

handleStartFunction · 0.90
invokeViaDaemonMethod · 0.90

Calls 5

isRunningMethod · 0.95
statusMethod · 0.95
forceStopDaemonFunction · 0.85
startDaemonBackgroundFunction · 0.85
waitForDaemonReadyFunction · 0.85

Tested by

no test coverage detected