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

Function withDaemonDataDir

tests/daemon-state.test.ts:57–75  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>)

Source from the content-addressed store, hash-verified

55const daemonStateLayer = Layer.merge(fileSystemLayer, Path.layer);
56
57const withDaemonDataDir = <A, E>(effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>) =>
58 Effect.acquireUseRelease(
59 Effect.sync(() => {
60 const prev = process.env.EXECUTOR_DATA_DIR;
61 const dir = mkdtempSync(join(tmpdir(), "executor-daemon-state-test-"));
62 process.env.EXECUTOR_DATA_DIR = dir;
63 return { dir, prev };
64 }),
65 () => effect,
66 ({ dir, prev }) =>
67 Effect.sync(() => {
68 if (prev === undefined) {
69 delete process.env.EXECUTOR_DATA_DIR;
70 } else {
71 process.env.EXECUTOR_DATA_DIR = prev;
72 }
73 rmSync(dir, { recursive: true, force: true });
74 }),
75 ).pipe(Effect.provide(daemonStateLayer));
76
77describe("daemon state", () => {
78 it("normalizes local host aliases", () => {

Callers 1

Calls 1

syncMethod · 0.65

Tested by

no test coverage detected