MCPcopy Create free account
hub / github.com/anomalyco/opencode / atomicMkdir

Function atomicMkdir

packages/core/src/util/effect-flock.ts:117–125  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

115
116 /** Atomic mkdir — returns true if created, false if already exists, dies on other errors. */
117 const atomicMkdir = (dir: string) =>
118 fs.makeDirectory(dir, { mode: 0o700 }).pipe(
119 Effect.as(true),
120 Effect.catchIf(
121 (e) => e.reason._tag === "AlreadyExists",
122 () => Effect.succeed(false),
123 ),
124 Effect.orDie,
125 )
126
127 /** Write with exclusive create — compromised error if file already exists. */
128 const exclusiveWrite = (filePath: string, content: string, lockDir: string, detail: string) =>

Callers 1

tryAcquireLockDirFunction · 0.85

Calls 1

asMethod · 0.80

Tested by

no test coverage detected