Readded timeout using JS instead of bash
This commit is contained in:
7
index.js
7
index.js
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user