diff --git a/src/frontends/tui/minimal.ts b/src/frontends/tui/minimal.ts index 12a73c7..c4c89ec 100644 --- a/src/frontends/tui/minimal.ts +++ b/src/frontends/tui/minimal.ts @@ -151,8 +151,12 @@ export class MinimalTui { resolve(''); return; } - this.rl.question(promptText, resolve); - this.rl.once('close', () => resolve('')); + const onClose = () => resolve(''); + this.rl.once('close', onClose); + this.rl.question(promptText, (answer) => { + this.rl?.removeListener('close', onClose); + resolve(answer); + }); }); }