MCPcopy Create free account
hub / github.com/Effect-TS/effect / withRestoredIsTTY

Function withRestoredIsTTY

packages/platform/node-shared/test/NodeStdio.test.ts:14–29  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

12 })
13
14const withRestoredIsTTY = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
15 Effect.acquireUseRelease(
16 Effect.sync(() => streams.map((stream) => Object.getOwnPropertyDescriptor(stream, "isTTY"))),
17 () => effect,
18 (descriptors) =>
19 Effect.sync(() => {
20 streams.forEach((stream, index) => {
21 const descriptor = descriptors[index]
22 if (descriptor === undefined) {
23 Reflect.deleteProperty(stream, "isTTY")
24 } else {
25 Object.defineProperty(stream, "isTTY", descriptor)
26 }
27 })
28 })
29 )
30
31describe("NodeStdio", () => {
32 it.effect("reads terminal state when the effects run", () =>

Callers 1

NodeStdio.test.tsFile · 0.85

Calls 3

forEachMethod · 0.65
syncMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected