From 072e26dfbfc2622a347eac3eecf44d10ff473419 Mon Sep 17 00:00:00 2001 From: Taksh Pratap Singh Date: Mon, 5 Feb 2024 15:48:27 -0500 Subject: [PATCH] reject toPrompt promise on exit (eg with ESC key) this is an open issue in the library: https://github.com/terkelg/prompts/issues/362 here's a fix for this that someone made a while ago (which has not been merged for some reason): https://github.com/terkelg/prompts/pull/369 This PR makes the same fix in our internal fork --- lib/prompts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prompts.js b/lib/prompts.js index 9f625564..e08923fc 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -11,7 +11,7 @@ function toPrompt(type, args, opts={}) { const onExit = opts.onExit || noop; p.on('state', args.onState || noop); p.on('submit', x => res(onSubmit(x))); - p.on('exit', x => res(onExit(x))); + p.on('exit', x => rej(onExit(x))); p.on('abort', x => rej(onAbort(x))); }); }