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

pull/2607/head
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
1 changed files with 7 additions and 3 deletions

View File

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