-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
App cleanly exits but does not restart #1176
Comments
Also worth noting, if I don't add the
|
Also also, if I follow the instructions here and do: |
I have now taken out all the signal handling code and am using |
I just walked versions back by minor, and when I got back to |
Can you try with 1.13.3? There was a process kill change in .2 that was fixed in .3 - it's possible it's that. Otherwise, can you provide a package.json + index.js via a gist to replicate with? |
(sorry, I see you have your package there already, and I suspect the example file you included is enough - can you just give it a test with the latest build?) |
Same error with nodejs 6.0.0, when I save the file is not restarting the nodemon execution, but remains active in the console without reload. |
@4sh3 can you confirm nodemon version? |
I'm getting what seems to be the same issue. The standard OS: MacOS Sierra (10.12.6) |
Tried it with |
Okay, I think I've got to the bottom of this, but it's down to how you're handling the signal inside your own script. When your script handles the signal, it still needs to exit, but it needs to exit with a signal that nodemon can respond to. Since your original code was exiting with Using your example from an earlier comment, here's the changes required to make the example work: --- a/yours.js
+++ b/mine.js
-export const shutdown = () => {
+export const shutdown = signal => () => {
shutdownClient();
if (server) {
logger.info('Shutting down service...');
server.close();
}
logger.info('Cleanly shut down.');
running = false;
- // process.exit(0) // this line does not seem to have any effect
+ process.kill(process.pid, signal); // this line does not seem to have any effect
};
const shutdownSignals = ['SIGTERM', 'SIGINT', 'SIGUSR2'];
-shutdownSignals.forEach(signal => process.on(signal, shutdown));
+shutdownSignals.forEach(signal => process.once(signal, shutdown(signal))); The most important two changes are that instead of I hope that makes sense. It is in the documentation, but I'll make a note to highlight the importance of using |
Didnt seem to work for me =/ |
nodemon -v
:1.13.2
node -v
:v9.2.0
yarn start
where mystart
script isnodemon | pino-colada
(works the same without the piped output topino-colada
, but is less intelligible. I have also tried this with the-L
flag, and that seems to have no effect. I am guessing I am missing something...In
package.json
:I am running a
webpack --watch
to recompile the script intodist/
.Output:
Expected behaviour
I would expect the script to receive a
SIGUSR2
signal, then after cleanly exiting, restart the script.Actual behaviour
It gets the
SIGUSR2
signal, cleanly exits, then does not restart.Steps to reproduce
I believe the steps are well documented above.
If applicable, please append the
--dump
flag on your command and include the output here **ensuring to remove any sensitive/personal details or tokens.Dump output:
The text was updated successfully, but these errors were encountered: