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

Function withPlatform

packages/opencode/test/config/tui.test.ts:55–70  ·  view source on GitHub ↗
(platform: typeof process.platform, self: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

53 )
54
55const withPlatform = <A, E, R>(platform: typeof process.platform, self: Effect.Effect<A, E, R>) =>
56 Effect.acquireUseRelease(
57 Effect.sync(() => {
58 const original = Object.getOwnPropertyDescriptor(process, "platform")
59 Object.defineProperty(process, "platform", {
60 ...original,
61 value: platform,
62 })
63 return original
64 }),
65 () => self,
66 (original) =>
67 Effect.sync(() => {
68 if (original) Object.defineProperty(process, "platform", original)
69 }),
70 )
71
72const getTuiConfig = (directory: string) =>
73 TuiConfig.Service.use((svc) => svc.get()).pipe(

Callers 1

tui.test.tsFile · 0.85

Calls 1

syncMethod · 0.80

Tested by

no test coverage detected