From 6adfdacb3c55bbc2b8c482c43b37952976586bf3 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 20 May 2019 20:43:25 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20quit=20twice.=20https://github.?= =?UTF-8?q?com/Koenkk/zigbee2mqtt/issues/1550?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c9f2eb59b..b881e2dab 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,11 @@ controller.start(); process.on('SIGINT', handleQuit); process.on('SIGTERM', handleQuit); +let stopping = false; + function handleQuit() { - controller.stop(() => process.exit()); + if (!stopping) { + stopping = true; + controller.stop(() => process.exit()); + } }