Merge pull request #7015 from KrugerHeavyIndustries/graceful_exit

graceful handling of SIGTERM and SIGINT such that return codes are mo…
This commit is contained in:
Isaac A. Murchie
2016-10-28 14:46:57 +02:00
committed by GitHub
+11
View File
@@ -132,6 +132,17 @@ async function main (args = null) {
await server.close();
throw err;
}
process.on('SIGINT', async function () {
logger.info(`Received SIGINT - shutting down`);
await server.close();
});
process.on('SIGTERM', async function () {
logger.info(`Received SIGTERM - shutting down`);
await server.close();
});
logServerPort(args.address, args.port);
return server;