jtlapp / node-cleanup

installs custom cleanup handlers that run on exiting node
MIT License
164 stars 10 forks source link

Nodemon seems to not fire my shutdown function #12

Closed m00nwtchr closed 6 years ago

jtlapp commented 6 years ago

According to this nodemon issue, nodemon does not appear to give child processes a chance to handle signals. Nothing either of us can do about it but go fix nodemon.

m00nwtchr commented 6 years ago

hmm k

m00nwtchr commented 6 years ago

hmm maybe you could fix this by doing what they suggest in here? https://github.com/remy/nodemon/blob/master/README.md#controlling-shutdown-of-your-script

jtlapp commented 6 years ago

Good find, but SIGUSR2 isn't a shutdown signal. An application receiving it could do anything it wants and need not shut down. So node-cleanup can't shutdown upon detecting it.

You might implement that yourself in your app. It's kinda weird that an app would need to implement a special shutdown process just to run properly under nodemon.

m00nwtchr commented 6 years ago

true.. maybe there's a way to figure out if you are running under node mon and use that event only in such a case?