Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 24, 2021
1 parent 9c5ebee commit d739ceb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1116,11 +1116,15 @@ class Server {

let needForceShutdown = false;

const exitProcess = () => {
// eslint-disable-next-line no-process-exit
process.exit();
};

signals.forEach((signal) => {
process.on(signal, () => {
if (needForceShutdown) {
// eslint-disable-next-line no-process-exit
process.exit();
exitProcess();
}

this.logger.info(
Expand All @@ -1130,14 +1134,10 @@ class Server {
needForceShutdown = true;

this.stopCallback(() => {
if (this.compiler.close) {
this.compiler.close(() => {
// eslint-disable-next-line no-process-exit
process.exit();
});
if (typeof this.compiler.close === "function") {
this.compiler.close(exitProcess);
} else {
// eslint-disable-next-line no-process-exit
process.exit();
exitProcess();
}
});
});
Expand Down

0 comments on commit d739ceb

Please sign in to comment.