Changed stdio

This commit is contained in:
2023-06-26 10:19:54 +02:00
parent d71ffd5f8d
commit eae1bf2a5c

View File

@@ -152,7 +152,7 @@ async function startBot(accountName) {
return new Promise((resolve, reject) => {
// const childProcess = spawn('bash', ['-c', `${commandPrefix} ${commandSuffix}`], { stdio: 'inherit' });
const childProcess = spawn('bash', ['-c', `${commandPrefix} ${commandSuffix}`], {
stdio: ['pipe', 'pipe', 'pipe'],
stdio: ['inherit', 'pipe', process.stderr],
});
childProcess.stdout.on('data', (data) => {
@@ -179,6 +179,10 @@ async function startBot(accountName) {
}
});
childProcess.on('close', (code) => {
console.log(`[${accountName}] Child process exited with code ${code}`);
});
childProcess.on('error', (err) => {
consoleLog(`[${host}] Failed to start bot for ${accountName}.`, 'error');
reject(err);