From 44fc68d7ee1b94ad67a211a6ff8234ce4ff760c8 Mon Sep 17 00:00:00 2001 From: Nihonium <77746579+nihonium-cfx@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:28:38 +0300 Subject: [PATCH] fix(yarn): Pipe yarn_cli output to main output Apparently *sometimes* yarn_cli is locking up due to stdio being `silent`. Other than that, it will now print helpful data. --- resources/[system]/[builders]/yarn/yarn_builder.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/[system]/[builders]/yarn/yarn_builder.js b/resources/[system]/[builders]/yarn/yarn_builder.js index c5db7ec..5e85d83 100644 --- a/resources/[system]/[builders]/yarn/yarn_builder.js +++ b/resources/[system]/[builders]/yarn/yarn_builder.js @@ -41,13 +41,16 @@ const yarnBuildTask = { } buildingInProgress = true; currentBuildingModule = resourceName; - const process = child_process.fork( + const proc = child_process.fork( require.resolve('./yarn_cli.js'), ['install', '--ignore-scripts', '--cache-folder', path.join(initCwd, 'cache', 'yarn-cache'), '--mutex', 'file:' + path.join(initCwd, 'cache', 'yarn-mutex')], { - cwd: path.resolve(GetResourcePath(resourceName)) + cwd: path.resolve(GetResourcePath(resourceName)), + stdio: 'pipe', }); - process.on('exit', (code, signal) => { + proc.stdout.on('data', (data) => console.log('[yarn]', data.toString())); + proc.stderr.on('data', (data) => console.error('[yarn]', data.toString())); + proc.on('exit', (code, signal) => { setImmediate(() => { if (code != 0 || signal) { buildingInProgress = false;