소스 검색

- Extract signal handler to trigger on "SIGINT" and "SIGTERM"

Parad0x 7 년 전
부모
커밋
eda18b4d6a
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      src/index.js

+ 5 - 2
src/index.js

@@ -42,11 +42,14 @@ const socketPath = socketPathCon();
     })
   });
 
-  process.on("SIGINT", () => {
+  const sigHandler = () => {
     console.log("Closing server");
     server.close(() => {
       console.log("Server closed");
       process.exit(0);
     });
-  })
+  };
+
+  process.on("SIGINT", sigHandler);
+  process.on("SIGTERM", sigHandler);
 })();