1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Prevent RED.stop being called multiple times if >1 signal received

This commit is contained in:
Nick O'Leary 2020-06-09 08:23:12 +01:00
parent fe4ef354ac
commit 6d294a0c74
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -448,10 +448,14 @@ httpsPromise.then(function(startupHttps) {
process.exit(1); process.exit(1);
}); });
var stopping = false;
function exitWhenStopped() { function exitWhenStopped() {
RED.stop().then(function() { if (!stopping) {
process.exit(); stopping = true;
}); RED.stop().then(function() {
process.exit();
});
}
} }
process.on('SIGINT', exitWhenStopped); process.on('SIGINT', exitWhenStopped);
process.on('SIGTERM', exitWhenStopped); process.on('SIGTERM', exitWhenStopped);