mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
22 lines
486 B
JavaScript
22 lines
486 B
JavaScript
'use strict';
|
|
|
|
const signals = ['SIGINT', 'SIGTERM'];
|
|
|
|
function setupExitSignals(serverData) {
|
|
signals.forEach((signal) => {
|
|
process.on(signal, () => {
|
|
if (serverData && serverData.server) {
|
|
serverData.server.close(() => {
|
|
// eslint-disable-next-line no-process-exit
|
|
process.exit();
|
|
});
|
|
} else {
|
|
// eslint-disable-next-line no-process-exit
|
|
process.exit();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = setupExitSignals;
|