oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.76k stars 2.55k forks source link

Bun terminates windows batch script(.cmd) but, node.js not. #12108

Open songinnight opened 1 week ago

songinnight commented 1 week ago

What version of Bun is running?

1.1.16

What platform is your computer?

Windows 11

What steps can reproduce the bug?

Bun terminates windows batch script(.cmd) but, node.js not. Therefore, I cannot run the following commands in sequence.

test.js

setTimeout(() => {
    console.log('Proc Finished. Bun terminates windows batch script(.cmd) but, node.js not.');

    // The code below gives the same result.
    // process.exit();
    // process.exit(0);
    // process.exit(1);
}, 1000);

batch.cmd

@echo off

echo Start Bun
bun test.js

echo It doesn't get there.

What is the expected behavior?

Bun should not stop windows batch script.

What do you see instead?

No response

Additional information

No response

paperdave commented 6 days ago

I cannot reproduce this in powershell or cmd / Windows terminal or conhost. image

can you reply with more details about how your script is being executed.

github-actions[bot] commented 6 days ago

Hello @songinnight. Please provide a minimal reproduction using a GitHub repository, Replit, or CodeSandbox. Issues marked with needs repro will be closed if they have no activity within 3 days.

songinnight commented 5 days ago

https://github.com/songinnight/bun-bug-windows-batch

I don't know if it's only happening on my computer with Windows. Is everyone else okay? When I running on Linux(Ubuntu) or WSL, there's no problem.

test.js

console.log('This is Bun');

test.cmd

@echo off

echo Start Bun

bun test.js

echo It doesn't get there.

bun test.js

bun test.js

bun test.js

bb

cc