[BUG] Improper handling of graceful exits with `npx`
Open
Nobody has claimed this yet.
Bug
Priority 2
signals
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
Sending a SIGINT signal using npx node anything.js will result in a double SIGINT received by the application code.
Expected Behavior
Just one signal to be received by the application code.
Steps To Reproduce
console.log('starting up')
process.on('SIGINT', () => {
console.log('shutting down')
// simulate cleanup
setTimeout(() => {
console.log('cleanly exiting')
process.exit(0)
}, 5000)
})
// run forever
setInterval(() => {}, 1 << 30)
╭─greguz@prunix ~/Development/issue
╰─$ npx node z.js
starting up
^Cshutting down
shutting down
cleanly exiting
Environment
- npm: v11.2.0
- Node.js: v23.10.0
- OS Name: macOS 15.3.2 (24D81)
- System Model Name: Apple M2 Pro
- npm config:
; "user" config from /Users/greguz/.npmrc
//registry.npmjs.org/:_authToken = (protected)
; node bin location = /Users/greguz/.local/share/fnm/node-versions/v23.10.0/installation/bin/node
; node version = v23.10.0
; npm local prefix = /Users/greguz/Development/evologi/orderpod-dlr
; npm version = 11.2.0
; cwd = /Users/greguz/Development/evologi/orderpod-dlr
; HOME = /Users/greguz
; Run `npm config ls -l` to show all defaults.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with npx node anything.js and the SIGINT-handling example from the issue, then trace the npx entry point and its signal handling. Done means the application receives one SIGINT and still performs its delayed clean shutdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100