mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #2447 from node-red/catch-more-signals
catch more signals to allow clean context flush on shutdown
This commit is contained in:
commit
e930098b51
11
packages/node_modules/node-red/red.js
vendored
11
packages/node_modules/node-red/red.js
vendored
@ -429,11 +429,20 @@ httpsPromise.then(function(startupHttps) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('SIGINT', function () {
|
function exitWhenStopped() {
|
||||||
RED.stop().then(function() {
|
RED.stop().then(function() {
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
process.on('SIGINT', exitWhenStopped);
|
||||||
|
process.on('SIGTERM', exitWhenStopped);
|
||||||
|
process.on('SIGHUP', exitWhenStopped);
|
||||||
|
process.on('SIGUSR2', exitWhenStopped); // for nodemon restart
|
||||||
|
process.on('SIGBREAK', exitWhenStopped); // for windows ctrl-break
|
||||||
|
process.on('message', function(m) { // for PM2 under window with --shutdown-with-message
|
||||||
|
if (m === 'shutdown') { exitWhenStopped() }
|
||||||
});
|
});
|
||||||
|
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log("Failed to get https settings: " + err);
|
console.log("Failed to get https settings: " + err);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user