Last change
on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
486 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | const signals = ['SIGINT', 'SIGTERM'];
|
---|
| 4 |
|
---|
| 5 | function setupExitSignals(serverData) {
|
---|
| 6 | signals.forEach((signal) => {
|
---|
| 7 | process.on(signal, () => {
|
---|
| 8 | if (serverData && serverData.server) {
|
---|
| 9 | serverData.server.close(() => {
|
---|
| 10 | // eslint-disable-next-line no-process-exit
|
---|
| 11 | process.exit();
|
---|
| 12 | });
|
---|
| 13 | } else {
|
---|
| 14 | // eslint-disable-next-line no-process-exit
|
---|
| 15 | process.exit();
|
---|
| 16 | }
|
---|
| 17 | });
|
---|
| 18 | });
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | module.exports = setupExitSignals;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.