Skip to content

Commit dd42d13

Browse files
refactor: more
1 parent 1c27185 commit dd42d13

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed

lib/Server.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const colors = require('./utils/colors');
1313
const routes = require('./utils/routes');
1414
const getSocketServerImplementation = require('./utils/getSocketServerImplementation');
1515
const getCompilerConfigArray = require('./utils/getCompilerConfigArray');
16-
const setupExitSignals = require('./utils/setupExitSignals');
1716
const getStatsOption = require('./utils/getStatsOption');
1817
const schema = require('./options.json');
1918

@@ -65,7 +64,19 @@ class Server {
6564
this.createServer();
6665

6766
killable(this.server);
68-
setupExitSignals(this);
67+
68+
if (this.options.setupExitSignals) {
69+
const signals = ['SIGINT', 'SIGTERM'];
70+
71+
signals.forEach((signal) => {
72+
process.on(signal, () => {
73+
this.close(() => {
74+
// eslint-disable-next-line no-process-exit
75+
process.exit();
76+
});
77+
});
78+
});
79+
}
6980

7081
// Proxy WebSocket without the initial http request
7182
// https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade

lib/utils/setupExitSignals.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)