From d1336e8c98b909a178fe91a5ecd346fd1da802d1 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Wed, 3 Jul 2024 19:13:46 +0200 Subject: [PATCH] chore: Simplify emulator output handling (#754) --- lib/tools/system-calls.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/tools/system-calls.js b/lib/tools/system-calls.js index d279b150..4de91164 100644 --- a/lib/tools/system-calls.js +++ b/lib/tools/system-calls.js @@ -941,11 +941,9 @@ systemCallMethods.launchAVD = async function launchAVD (avdName, opts = {}) { env: Object.assign({}, process.env, env), }); await proc.start(0); - proc.on('output', (stdout, stderr) => { - for (let line of (stdout || stderr || '').split('\n').filter(Boolean)) { - log.info(`[AVD OUTPUT] ${line}`); - } - }); + for (const streamName of ['stderr', 'stdout']) { + proc.on(`line-${streamName}`, (line) => log.debug(`[AVD OUTPUT] ${line}`)); + } proc.on('die', (code, signal) => { log.warn(`Emulator avd ${avdName} exited with code ${code}${signal ? `, signal ${signal}` : ''}`); });