Closed olafur-palsson closed 10 months ago
it happened on my side too.
true true just run bun run example.js
on this repo and on second question my WSL is hang :)
refer to this https://github.com/oven-sh/bun/issues/4664
I took a look around and a lot of interactive cli stuff is having issues. https://github.com/oven-sh/bun/issues/4787 https://github.com/oven-sh/bun/issues/5267 https://github.com/oven-sh/bun/issues/5240 https://github.com/oven-sh/bun/issues/3255 https://github.com/oven-sh/bun/issues/2333
But here's one that says it's fixed in the upcoming bun release which was 1.0 at the time (@clack/prompts on npm) but I've been running it on Bun 1.0 and still have the same bug. https://github.com/natemoo-re/clack/issues/159
@olafur-palsson Hi, for me Bun with @clack/prompts
is no problem, but with terkelg/prompts
has the issue CMIIW.
In @clack/prompts to test is easy, just clone that repo, and run bun --bun run examples/basic/index.ts
it run smooth :)
@sonyarianto
They have issue with these. There's some weird behavior when closing the readline
interface in Bun I think.
Try running this one:
import * as p from '@clack/prompts';
await p.text({
message: 'Where should we create your project?',
placeholder: './lol',
})
await p.text({
message: 'Where should we create your project?',
placeholder: './lol',
})
I didn't read @clack/prompts
but I know that terkelg/prompts
creates readline
interfaces and closes them for each question. Maybe @clack/prompts
keeps it open longer?
Hmmm with Bun 1.0.2 above script also still not working properly.
@olafur-palsson butttt if you modify the code like this, inside the async then it will work smoothly.
index.js
import * as p from '@clack/prompts';
async function main() {
const response1 = await p.text({
message: 'Where should we create your project?',
placeholder: './lol',
});
const response2 = await p.text({
message: 'Where should we create your project?',
placeholder: './lol',
});
}
await main();
bun --bun run index.js
This issue has already been addressed in the latest release of Bun, v1.0.18. You can find more details about the fix in the release notes: Bun v1.0.18 Release Notes.
Confirmed that this is no longer an issue with Bun v1.0.18, so this issue can probably be closed.
This can still happen on Bun, even after their v1.0.18 version.
Here's a repro/bug on Bun's issue tracker: https://github.com/oven-sh/bun/issues/9855#issuecomment-2224861121
Is your feature request related to a problem?
This is something odd I noticed. It looks like in general prompts works except when you run two question sequentially.
Describe the solution you'd like
It works when running with bun like when running with node.
Describe alternatives you've considered
Using node lol.
Additional context
None