Readded timeout using JS instead of bash

This commit is contained in:
2023-06-26 09:47:43 +02:00
parent c50998eb82
commit 465835c185

View File

@@ -150,7 +150,7 @@ async function startBot(accountName) {
}
return new Promise((resolve, reject) => {
const childProcess = spawn('timeout 150m bash', ['-c', `${commandPrefix} ${commandSuffix}`], { stdio: 'inherit' });
const childProcess = spawn('bash', ['-c', `${commandPrefix} ${commandSuffix}`], { stdio: 'inherit' });
childProcess.stdout.on('data', (data) => {
console.log(`[${accountName}] ${data.toString()}`);
@@ -175,6 +175,11 @@ async function startBot(accountName) {
consoleLog(`[${host}] Failed to start bot for ${accountName}.`, 'error');
reject(err);
});
setTimeout(() => {
consoleLog(`[${host}] Bot process for ${accountName} exceeded the timeout. Killing the process...`, 'error');
childProcess.kill();
}, 150 * 60 * 1000);
});
}
else {