(rl: readline.promises.Interface)
| 76 | * Creates a proxy that aborts the readline interface when the underlying stream closes. |
| 77 | */ |
| 78 | export 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 | |
| 92 | export async function handleNpsSurveyImpl( |
| 93 | now: Date, |
no test coverage detected