Closed as not planned
Description
Version
24.1.0
Platform
Linux colima 6.8.0-50-generic #51-Ubuntu SMP PREEMPT_DYNAMIC Sat Nov 9 18:03:35 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Reproduce steps:
- create
package.json
:{"scripts":{"x":"node x.js"}}
- create
x.js
:
setTimeout(() => {
process.exit(0);
}, 10_000);
process.addListener('SIGINT', () => {
console.log('SIGINT');
});
process.addListener('SIGTERM', () => {
console.log('SIGTERM');
});
- run
node --run x
- press
ctrl+c
to kill it.
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
It should not be killed. Just like the behavior of running npm run x
.
What do you see instead?
The process is killed.
Additional information
This behavior seems unsafe for backend app using Node.js, because backend app started by node --run
will do cleaning once it receives SIGINT or SIGTERM from docker container. Docker container may stop immediately because node --run
has already exited.
Metadata
Metadata
Assignees
Labels
No labels