From 006e6e03a1eff2d417bc7a7aff8ade9928c1ba11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 2 Oct 2019 14:09:20 +0200 Subject: [PATCH 1/2] Fixes Node forwarding w/ yarn-path --- src/cli/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/index.js b/src/cli/index.js index 2ed29cbef0..7ca0bcc0f4 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -617,10 +617,10 @@ async function start(): Promise { let exitCode = 0; try { - exitCode = await spawnp(yarnPath, argv, opts); + exitCode = await forkp(yarnPath, argv, opts); } catch (firstError) { try { - exitCode = await forkp(yarnPath, argv, opts); + exitCode = await spawnp(yarnPath, argv, opts); } catch (error) { throw firstError; } From d0e4eec94f3c307be2b308cf7b027c96ebc39f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 2 Oct 2019 14:24:54 +0200 Subject: [PATCH 2/2] Fixes spawning --- src/cli/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli/index.js b/src/cli/index.js index 7ca0bcc0f4..29ed981060 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -617,10 +617,14 @@ async function start(): Promise { let exitCode = 0; try { - exitCode = await forkp(yarnPath, argv, opts); + if (yarnPath.endsWith(`.js`)) { + exitCode = await spawnp(process.execPath, [yarnPath, ...argv], opts); + } else { + exitCode = await spawnp(yarnPath, argv, opts); + } } catch (firstError) { try { - exitCode = await spawnp(yarnPath, argv, opts); + exitCode = await forkp(yarnPath, argv, opts); } catch (error) { throw firstError; }