Skip to content

Commit

Permalink
fix(packager): output rebuild errors if there are any
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored and malept committed Dec 11, 2016
1 parent ed9137d commit f8ffca1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default async (buildPath, electronVersion, pPlatform, pArch) => {
await new Promise((resolve, reject) => {
const child = spawn(process.execPath, [path.resolve(__dirname, '../../node_modules/.bin/node-gyp')].concat(rebuildArgs), {
cwd: modulePath,
// stdio: 'inherit',
env: Object.assign({}, process.env, {
HOME: path.resolve(os.homedir(), '.electron-gyp'),
USERPROFILE: path.resolve(os.homedir(), '.electron-gyp'),
Expand All @@ -54,9 +53,12 @@ export default async (buildPath, electronVersion, pPlatform, pArch) => {
npm_config_build_from_source: true,
}),
});
let output = '';
child.stdout.on('data', (data) => { output += data; });
child.stderr.on('data', (data) => { output += data; });
child.on('exit', async (code) => {
d('built:', path.basename(modulePath));
if (code !== 0) return reject(new Error(`Failed to rebuild: ${modulePath}`));
if (code !== 0) return reject(new Error(`Failed to rebuild: ${modulePath}\n\n${output}`));
await pify(mkdirp)(path.dirname(metaPath));
await fs.writeFile(metaPath, pArch);
resolve();
Expand Down

0 comments on commit f8ffca1

Please sign in to comment.