Better Handling of process
This commit is contained in:
13
index.js
13
index.js
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user