MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / startServerOrAttachOwnedDataDir

Function startServerOrAttachOwnedDataDir

apps/cli/src/main.ts:309–324  ·  view source on GitHub ↗
(
  options: StartServerOptions,
)

Source from the content-addressed store, hash-verified

307 });
308
309const startServerOrAttachOwnedDataDir = (
310 options: StartServerOptions,
311): Effect.Effect<LocalServerStartResult, Error, FileSystem.FileSystem | PlatformPath.Path> =>
312 Effect.tryPromise({
313 try: () => startServer(options),
314 catch: (cause) => cause,
315 }).pipe(
316 Effect.map((server) => ({ kind: "started" as const, server })),
317 Effect.catch((cause) => {
318 const ownership = findDataDirOwnershipHeld(cause);
319 if (!ownership) return Effect.fail(toError(cause));
320 return attachToOwnedDataDirServerOrFail({ lockPath: ownership.lockPath }).pipe(
321 Effect.map((manifest) => ({ kind: "attached" as const, manifest })),
322 );
323 }),
324 );
325
326const parseDaemonUrl = (baseUrl: string) =>
327 Effect.try({

Callers 2

runForegroundSessionFunction · 0.85
runDaemonSessionFunction · 0.85

Calls 4

startServerFunction · 0.90
findDataDirOwnershipHeldFunction · 0.90
toErrorFunction · 0.70

Tested by

no test coverage detected