From ac4989d51a40f04024bdc1ff8e4c812c1a8710d2 Mon Sep 17 00:00:00 2001 From: Dan Muller Date: Mon, 2 Nov 2020 16:04:02 +0000 Subject: [PATCH] fix: log on standalone failures --- .../internal/worker/worker_adapter.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/typescript/internal/worker/worker_adapter.js b/packages/typescript/internal/worker/worker_adapter.js index 88a95fe90d..f96d3f08f2 100644 --- a/packages/typescript/internal/worker/worker_adapter.js +++ b/packages/typescript/internal/worker/worker_adapter.js @@ -61,7 +61,25 @@ async function main() { `Started a new process to perform this action. Your build might be misconfigured, try --strategy=${MNEMONIC}=worker`); - child.on('exit', code => process.exit(code)); + const stdoutbuffer = []; + child.stdout.on('data', data => stdoutbuffer.push(data)); + + const stderrbuffer = []; + child.stderr.on('data', data => stderrbuffer.push(data)); + + child.on('exit', code => { + if (code !== 0) { + console.error( + `\nstdout from tsc:\n\n ${ + stdoutbuffer.map(s => s.toString()).join('').replace(/\n/g, '\n ')}`, + ) + console.error( + `\nstderr from tsc:\n\n ${ + stderrbuffer.map(s => s.toString()).join('').replace(/\n/g, '\n ')}`, + ) + } + process.exit(code) + }); } }