MCPcopy
hub / github.com/prisma/prisma / createSafeReadlineProxy

Function createSafeReadlineProxy

packages/cli/src/utils/nps/survey.ts:78–90  ·  view source on GitHub ↗
(rl: readline.promises.Interface)

Source from the content-addressed store, hash-verified

76 * Creates a proxy that aborts the readline interface when the underlying stream closes.
77 */
78export function createSafeReadlineProxy(rl: readline.promises.Interface): ReadlineInterface {
79 const controller = new AbortController()
80 rl.on('close', () => controller.abort())
81
82 const rlProxy = new Proxy(rl, {
83 get(target, prop, receiver) {
84 controller.signal.throwIfAborted()
85 return Reflect.get(target, prop, receiver)
86 },
87 })
88
89 return rlProxy
90}
91
92export async function handleNpsSurveyImpl(
93 now: Date,

Callers 2

nps.test.tsFile · 0.90
handleNpsSurveyFunction · 0.85

Calls 1

onMethod · 0.65

Tested by

no test coverage detected