From 39b89b40ba15d2bf7f643df65d86ad4cf9886ff8 Mon Sep 17 00:00:00 2001 From: Lea Date: Sat, 29 Apr 2023 08:39:12 +0200 Subject: [PATCH] handle failed restart command --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index 3d18ebc..4dc3d96 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,9 @@ const runRestarts = async (status: Awaited>) => const result = exec(RESTART_COMMAND_BOT!); result.stdout?.on('data', data => console.log(data)); result.stderr?.on('data', data => console.log(data)); + result.on('exit', code => { + if (code != 0) restarting.bot = false; // Assume restart command has failed + }); } catch(e) { console.log(e); } @@ -96,6 +99,9 @@ const runRestarts = async (status: Awaited>) => const result = exec(RESTART_COMMAND_BRIDGE!); result.stdout?.on('data', data => console.log(data)); result.stderr?.on('data', data => console.log(data)); + result.on('exit', code => { + if (code != 0) restarting.bridge = false; + }); } catch(e) { console.log(e); }