143(SIGTERM) / 130(SIGINT) instead of gracefully shutdown
See original GitHub issueCouldn’t use nodemon with concurrently or something similar, cause If I kill npm script with nodemon, then npm outputs have errors
npx nodemon -v: 2.0.4node -v: v14.13.0- Operating system/terminal environment: Arch Linux / kitty
- Command you ran:
npm run start
Expected behaviour
Successful exit without ERR from npm
Actual behaviour
[1] sleep 2 exited with code 0
--> Sending SIGTERM to other processes..
[0] npm run nodemon exited with code SIGTERM
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@1.0.0 start: `npx concurrently -k "npm run nodemon" "sleep 2"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vlad/.npm/_logs/2020-10-10T14_28_36_051Z-debug.log
Steps to reproduce
Simple index.js:
let jobs = setInterval(() => {}, 1000)
process.on('SIGTERM', () => { jobs.unref() })
part of package.json:
"scripts": {
"start": "npx concurrently -k \"npm run nodemon\" \"sleep 2\"",
"nodemon": "npx nodemon ./index.js"
},
"devDependencies": {
"concurrently": "^5.3.0",
"nodemon": "^2.0.4"
}
Command to reproduce:
npm run start
I find the line which is the cause all of this, but i dont understand how can i workarund there
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
SIGTERM : Linux Graceful Termination | Exit code 143, Signal ...
The SIGTERM signal provides an elegant way to terminate a program, giving it the opportunity to prepare to shut down and perform cleanup...
Read more >Set exit code when receiving SIGTERM in Quarkus
I have read Graceful Shutdown but it does not talk about specifically ... I get an exit code of 143 upon SIGTERM, and...
Read more >When does the system send a SIGTERM to a process?
The return code 0 means a normal exit. If there was a SIGTERM, $? would be set to 143 (128 + signal number)....
Read more >Docker features for handling Container's death and resurrection
This is done so that the program executing inside the container can use the SIGTERM signal to do the graceful shutdown of the...
Read more >Docker, Java, Signals and Pid 1 - no42
Some can be caught by a running process and give people possibilities to implement logic to shutdown the application gracefully.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Done some experimenting tonight,
nodemon@2.0.6works seamlessly in this scenario, so rolling back to2.0.6for nowEDIT: Finally figured out the problem: the reason was me saving the file and killing the process at the same time ( happens because my editor saves file on focus change ). Sorry for flooding the thread with all this monologue, for some reason I was convinced the problem was in nodemon. Hopefully this information may be helpful to someone coming across the same issue =)
By the way I still get the same issue on Mac and Windows, and I am still not entirely sure what might be causing it though it gets a little less annoying after a while