From eae1bf2a5c340cc8270be96c2b93de8980fad0a5 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 26 Jun 2023 10:19:54 +0200 Subject: [PATCH] Changed stdio --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fc85e64..66d9b9d 100644 --- a/index.js +++ b/index.js @@ -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);