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); }