Skip to content

Commit

Permalink
Make yarn:electron fail explicitly on Windows
Browse files Browse the repository at this point in the history
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 <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Nov 12, 2019
1 parent a2d89c8 commit 9f9eaa4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions dev-packages/application-manager/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -43,12 +42,7 @@ 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);
}
require('electron-rebuild/lib/src/cli.js');
} finally {
setTimeout(() => {
fs.writeFile(packFile, packageText);
Expand Down

0 comments on commit 9f9eaa4

Please sign in to comment.