From 064fc51c150d88ad3a57ba70ae01586cdae2dab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Mar=C3=A9chal?= Date: Tue, 12 Nov 2019 15:32:37 -0500 Subject: [PATCH] Make `yarn:electron` fail explicitly on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the `yarn rebuild:electron` used to fail silently. We now get a proper output and exit code. Signed-off-by: Paul Maréchal --- dev-packages/application-manager/src/rebuild.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/dev-packages/application-manager/src/rebuild.ts b/dev-packages/application-manager/src/rebuild.ts index 9e6c36550025e..e672e7a6a3b38 100644 --- a/dev-packages/application-manager/src/rebuild.ts +++ b/dev-packages/application-manager/src/rebuild.ts @@ -16,7 +16,6 @@ import fs = require('fs-extra'); import path = require('path'); -import cp = require('child_process'); export function rebuild(target: 'electron' | 'browser', modules: string[]): void { const nodeModulesPath = path.join(process.cwd(), 'node_modules'); @@ -43,12 +42,8 @@ export function rebuild(target: 'electron' | 'browser', modules: string[]): void try { pack.dependencies = Object.assign({}, pack.dependencies, dependencies); fs.writeFileSync(packFile, JSON.stringify(pack, undefined, ' ')); - const electronRebuildPath = path.join(process.cwd(), 'node_modules', '.bin', 'electron-rebuild'); - if (process.platform === 'win32') { - cp.spawnSync('cmd', ['/c', electronRebuildPath]); - } else { - require(electronRebuildPath); - } + const electronRebuildPackageJson = require('electron-rebuild/package.json'); + require(`electron-rebuild/${electronRebuildPackageJson['bin']['electron-rebuild']}`); } finally { setTimeout(() => { fs.writeFile(packFile, packageText);