Skip to content

Commit 2560401

Browse files
committed
reject toPrompt promise on exit (eg with ESC key)
this is an open issue in the library: terkelg#362 here's a fix for this that someone made a while ago (which has not been merged for some reason): terkelg#369 This PR makes the same fix in our internal fork
1 parent 5f0d429 commit 2560401

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/prompts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function toPrompt(type, args, opts={}) {
1111
const onExit = opts.onExit || noop;
1212
p.on('state', args.onState || noop);
1313
p.on('submit', x => res(onSubmit(x)));
14-
p.on('exit', x => res(onExit(x)));
14+
p.on('exit', x => rej(onExit(x)));
1515
p.on('abort', x => rej(onAbort(x)));
1616
});
1717
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@withgraphite/prompts",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Lightweight, beautiful and user-friendly prompts",
55
"license": "MIT",
66
"repository": "withgraphite/prompts",

0 commit comments

Comments
 (0)