diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/open-url-prompt.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils/open-url-prompt.js b/lib/utils/open-url-prompt.js index 3eb3ac288..290040e5d 100644 --- a/lib/utils/open-url-prompt.js +++ b/lib/utils/open-url-prompt.js @@ -34,6 +34,11 @@ const promptOpen = async (npm, url, title, prompt, emitter) => { }) const tryOpen = await new Promise(resolve => { + rl.on('SIGINT', () => { + rl.close() + resolve('SIGINT') + }) + rl.question(prompt, () => { resolve(true) }) @@ -50,6 +55,10 @@ const promptOpen = async (npm, url, title, prompt, emitter) => { } }) + if (tryOpen === 'SIGINT') { + throw new Error('canceled') + } + if (!tryOpen) { return } |