handle failed restart command

This commit is contained in:
Lea 2023-04-29 08:39:12 +02:00
parent 13d526163f
commit 39b89b40ba
Signed by: Lea
GPG key ID: 1BAFFE8347019C42

View file

@ -84,6 +84,9 @@ const runRestarts = async (status: Awaited<ReturnType<typeof periodicCheck>>) =>
const result = exec(RESTART_COMMAND_BOT!); const result = exec(RESTART_COMMAND_BOT!);
result.stdout?.on('data', data => console.log(data)); result.stdout?.on('data', data => console.log(data));
result.stderr?.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) { } catch(e) {
console.log(e); console.log(e);
} }
@ -96,6 +99,9 @@ const runRestarts = async (status: Awaited<ReturnType<typeof periodicCheck>>) =>
const result = exec(RESTART_COMMAND_BRIDGE!); const result = exec(RESTART_COMMAND_BRIDGE!);
result.stdout?.on('data', data => console.log(data)); result.stdout?.on('data', data => console.log(data));
result.stderr?.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) { } catch(e) {
console.log(e); console.log(e);
} }