[BUG] SIGINT called twice
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] I am using the latest npm
Current Behavior
SIGINT is called twice, immediately terminating the process, causing any cleanup code that runs on SIGINT unable to run without hacking around and handling npm double fire or running the process outside of npm run
Expected Behavior
SIGINT is called just once
Steps To Reproduce
// some-script
#!/usr/bin/env node
// just to keep the process running
setInterval(() => {}, 10000)
process.on('SIGINT', () => {
console.log('SIGINT')
})
// package.json
"scripts": {
"doSomething": "./some-script"
}
and run it
npm run doSomething
and the output
> <project>@<version> doSomething
> ./do-something
^CSIGINT
SIGINT
Environment
- npm: 8.12.1
- Node.js: 16.13.1
- OS Name: macOS
- System Model Name: Monterey
Same issue here, with npx ts-node
I am not sure if this is the same issue, but I encountered double process termination prompts. It happens on some node/npm versions, but doesn't on others
I encounter this in different projects, for example let's take boilerplate vite project https://vitejs.dev/guide/
Reproduction: 0. Node v21.6.1, nvm v10.2.4
-
yarn create viteorpnpm create viteto install. This bug is NOT happening when the project is installed through npm -
npm run dev - Ctrl+C
- Two "terminate batch" promps
This also is happening on:
- Node v20.11.0, npm v10.2.4
- Node v18.19.0, npm v10.2.3
This is not happening on:
- Node v19.8.1, npm v9.5.1
System is Windows 11. I use nvm for windows as node version manager, not sure if it causes mess with npm versions