Open xixixao opened 5 months ago
I am seeing exactly the same thing in neonctl, but curiously I cannot reproduce with the repo from @xixixao. If I have this script.ts
like @xixixao and then run $ bun script.ts
, the interaction is fast:
import { execSync } from "child_process";
execSync("npx convex init", { stdio: "inherit" });
I am however, hitting this issue with this very similar line of code (npx vercel deploy
):
One way to reproduce this is by doing brew install neonctl
and then doing bun /opt/homebrew/bin/neonctl create-app
. Once you get to the Vercel deployment step, the interaction becomes super slow. This doesn't happen with Node.
I have tried to create a minimum reproducible example but I simply can't. I tried the following, for example:
import { execSync } from "child_process";
function test() {
execSync("command -v vercel", {
cwd: "./src",
stdio: "ignore",
});
execSync("npx vercel deploy", { stdio: "inherit" });
execSync("rm -rf test-dir && mkdir test-dir", { stdio: "inherit" });
execSync("npx vercel deploy", { stdio: "inherit", cwd: "test-dir" });
}
export const handler = async () => {
await test();
};
handler();
But it just doesn't repro there. I have also tried to use Bun.spawnSync
instead of execSync
from child_process
in neonctl, but the issue still happens.
This is all on Bun v1.1.18 (macOS arm64), Darwin Kernel Version 23.5.0.
I have managed to write a MRE (Minimum Reproducible Example):
Just run bun init
, bun add prompts vercel
and then bun index.ts
:
const prompts = require("prompts");
const { execSync } = require("child_process");
async function handler() {
const response = await prompts({
type: "text",
name: "name",
message: "What is your name?",
});
execSync("npx vercel deploy", { stdio: "inherit" });
}
handler();
The Vercel CLI will be very slow, but not if you use Node.
If you comment out the await prompts
call, then the issue doesn't happen.
@paperdave I read about how this is supposedly fixed in Bun v1.0.18, but I have managed to find a way to still hit it above.
I can confirm this is still happening on 1.1.20+ae1948925
.
Confirm still have this on 1.21.1
Can stil reproduce on 1.1.23.
Still happening for me with Expo EAS commands that involve interactive user input. I might be able to get a random character or two to appear, but CPU will spike and after hanging for 15-30 seconds, I'll manage to kill the process manually (ctrl+c).
Still happening for me with Expo EAS commands that involve interactive user input. I might be able to get a random character or two to appear, but CPU will spike and after hanging for 15-30 seconds, I'll manage to kill the process manually (ctrl+c).
seeing this exact issue as well
I can still reproduce on Bun 1.1.26.
What version of Bun is running?
1.1.0
What platform is your computer?
Darwin 23.2.0 arm64 arm
What steps can reproduce the bug?
In a new directory, add file
script.ts
:Then run:
Then run this again:
You will get an interactive prompt from Convex.
What is the expected behavior?
Running the script through Bun should have no impact on the interactivity of the inner command.
What do you see instead?
The interactivity is super slow. This is not an issue when running the
script.ts
through Node.Bun:
https://github.com/oven-sh/bun/assets/1473433/2a7d2d48-e6a8-461d-910b-bc55c8818126
Node:
https://github.com/oven-sh/bun/assets/1473433/ef724010-6798-4be2-afb2-bce7822ea37d
Additional information
Also quitting the nested command is super slow in Bun (but quick in Node).