Better Handling of process

This commit is contained in:
2023-06-26 10:35:32 +02:00
parent 5a2ef0f7ad
commit c058bf3414

View File

@@ -156,8 +156,9 @@ async function startBot(accountName) {
});
childProcess.stdout.on('data', (data) => {
console.log(`[${accountName}] STDOUT: ${data.toString().trim()}`);
if (data.includes('Press enter') || data.includes('Press any key')) {
const output = data.toString().trim();
console.log(`[${host}][${accountName}] STDOUT: ${output}`);
if (output.includes('Press enter') || output.includes('Press any key')) {
setTimeout(() => {
childProcess.stdin.write('\n');
}, 1000);
@@ -165,7 +166,13 @@ async function startBot(accountName) {
});
childProcess.stderr.on('data', (data) => {
console.error(`[${accountName}] STDERR: ${data.toString().trim()}`);
const output = data.toString().trim();
console.log(`[${host}][${accountName}] STDERR: ${output}`);
if (output.includes('Press enter') || output.includes('Press any key')) {
setTimeout(() => {
childProcess.stdin.write('\n');
}, 1000);
}
});
childProcess.on('exit', (code) => {