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

Function startServerOrAttachOwnedDataDir

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

Source from the content-addressed store, hash-verified

290 });
291
292const startServerOrAttachOwnedDataDir = (
293 options: StartServerOptions,
294): Effect.Effect<LocalServerStartResult, Error, FileSystem.FileSystem | PlatformPath.Path> =>
295 Effect.tryPromise({
296 try: () => startServer(options),
297 catch: (cause) => cause,
298 }).pipe(
299 Effect.map((server) => ({ kind: "started" as const, server })),
300 Effect.catch((cause) => {
301 const ownership = findDataDirOwnershipHeld(cause);
302 if (!ownership) return Effect.fail(toError(cause));
303 return attachToOwnedDataDirServerOrFail({ lockPath: ownership.lockPath }).pipe(
304 Effect.map((manifest) => ({ kind: "attached" as const, manifest })),
305 );
306 }),
307 );
308
309const parseDaemonUrl = (baseUrl: string) =>
310 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