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

Function startServerOrAttachOwnedDataDir

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

Source from the content-addressed store, hash-verified

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