import { input } from '@inquirer/prompts';
const answer = await input({ message: 'Enter your name' });
run bun run index.js
press ctrl + c to exit the program
What is the expected behavior?
ctrl + c exits the program, probably with an error. This is what happens with node index.js:
node index.js
? Enter your name
file:///Users/david/projects/linear-adder/node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs:36
reject(new Error(`User force closed the prompt with ${code} ${signal}`));
^
Error: User force closed the prompt with 0 null
at file:///Users/david/projects/linear-adder/node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs:36:28
at Emitter.emit (file:///Users/david/projects/linear-adder/node_modules/signal-exit/dist/mjs/index.js:67:19)
at #processEmit (file:///Users/david/projects/linear-adder/node_modules/signal-exit/dist/mjs/index.js:236:27)
at #process.emit (file:///Users/david/projects/linear-adder/node_modules/signal-exit/dist/mjs/index.js:187:37)
at process.callbackTrampoline (node:internal/async_hooks:130:17)
Node.js v18.18.0
What do you see instead?
On the first ctrl + c, nothing happens visually. But, the arrow keys stop working. Instead of moving the cursor, they print escape codes. For example, typing asdf + ^c + left arrow + left arrow prints asdf^[[D^[[D.
On the second ctrl + c, the program actually exits.
Additional information
Notably, if you try and submit input after the first ctrl + c (when you can still type input, but can't use arrow keys), the program will hang.
What version of Bun is running?
1.0.6+969da088f5db3258a803ec186012e30f992829b4
What platform is your computer?
Darwin 22.6.0 arm64 arm
What steps can reproduce the bug?
bun add @inquirer/prompts
index.js
:bun run index.js
ctrl + c
to exit the programWhat is the expected behavior?
ctrl + c
exits the program, probably with an error. This is what happens withnode index.js
:What do you see instead?
On the first
ctrl + c
, nothing happens visually. But, the arrow keys stop working. Instead of moving the cursor, they print escape codes. For example, typingasdf + ^c + left arrow + left arrow
printsasdf^[[D^[[D
.On the second
ctrl + c
, the program actually exits.Additional information
Notably, if you try and submit input after the first
ctrl + c
(when you can still type input, but can't use arrow keys), the program will hang.