mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
catch mode signals to allow clean context flush on shutdown
(yes the name is intentionally ironic) Code pattern copied from https://nodejs.org/api/process.html#process_signal_events
This commit is contained in:
parent
6b52206186
commit
fcf757f715
10
packages/node_modules/node-red/red.js
vendored
10
packages/node_modules/node-red/red.js
vendored
@ -342,8 +342,14 @@ process.on('uncaughtException',function(err) {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
function brexit() {
|
||||
RED.stop().then(function() {
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
process.on('SIGINT', brexit);
|
||||
process.on('SIGTERM', brexit);
|
||||
process.on('SIGHUP', brexit);
|
||||
process.on('SIGUSR2', brexit); // for nodemon restart
|
||||
process.on('SIGBREAK', brexit); // for windows ctrl-break
|
||||
|
Loading…
Reference in New Issue
Block a user