Skip to content

Commit d739ceb

Browse files
refactor: code
1 parent 9c5ebee commit d739ceb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/Server.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1116,11 +1116,15 @@ class Server {
11161116

11171117
let needForceShutdown = false;
11181118

1119+
const exitProcess = () => {
1120+
// eslint-disable-next-line no-process-exit
1121+
process.exit();
1122+
};
1123+
11191124
signals.forEach((signal) => {
11201125
process.on(signal, () => {
11211126
if (needForceShutdown) {
1122-
// eslint-disable-next-line no-process-exit
1123-
process.exit();
1127+
exitProcess();
11241128
}
11251129

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

11321136
this.stopCallback(() => {
1133-
if (this.compiler.close) {
1134-
this.compiler.close(() => {
1135-
// eslint-disable-next-line no-process-exit
1136-
process.exit();
1137-
});
1137+
if (typeof this.compiler.close === "function") {
1138+
this.compiler.close(exitProcess);
11381139
} else {
1139-
// eslint-disable-next-line no-process-exit
1140-
process.exit();
1140+
exitProcess();
11411141
}
11421142
});
11431143
});

0 commit comments

Comments
 (0)