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

Function startServerOrAttachOwnedDataDir

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

Source from the content-addressed store, hash-verified

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