Fixed shutdown signal compatibility issue with Node 20

fix https://linear.app/tryghost/issue/ENG-1250/fix-node-20-shutdown-signal-compatibility-issue

- in Node 20, support for string-based arguments to `process.exit` are
  removed
- we can just switch this to an anonymous function and call `.shutdown`
  directly, as we don't need to pass any integer codes to it
This commit is contained in:
Daniel Lockyer 2024-06-18 09:38:59 +02:00 committed by Daniel Lockyer
parent 4da6851113
commit 4ff51f4187

View File

@ -127,8 +127,8 @@ class GhostServer {
// ensure that Ghost exits correctly on Ctrl+C and SIGTERM
process
.removeAllListeners('SIGINT').on('SIGINT', self.shutdown.bind(self))
.removeAllListeners('SIGTERM').on('SIGTERM', self.shutdown.bind(self));
.removeAllListeners('SIGINT').on('SIGINT', () => self.shutdown())
.removeAllListeners('SIGTERM').on('SIGTERM', () => self.shutdown());
});
}