log error when pipeline dies

This commit is contained in:
Jonathan Rainville 2018-07-09 13:50:03 -04:00 committed by Iuri Matias
parent 611c2198a6
commit 3700323280
1 changed files with 11 additions and 1 deletions

View File

@ -101,15 +101,25 @@ class Pipeline {
// JS files // JS files
async.waterfall([ async.waterfall([
function runWebpack(next) { function runWebpack(next) {
let resulted = false;
const webpackProcess = new ProcessLauncher({ const webpackProcess = new ProcessLauncher({
modulePath: utils.joinPath(__dirname, 'webpackProcess.js'), modulePath: utils.joinPath(__dirname, 'webpackProcess.js'),
logger: self.logger, logger: self.logger,
events: self.events events: self.events,
exitCallback: function (code) {
if (!resulted) {
return next(`File building of ${file.filename} exited with code ${code} before the process finished`);
}
if (code) {
self.logger(__('File building process exited with code ', code));
}
}
}); });
webpackProcess.send({action: constants.pipeline.init, options: {}}); webpackProcess.send({action: constants.pipeline.init, options: {}});
webpackProcess.send({action: constants.pipeline.build, file, importsList}); webpackProcess.send({action: constants.pipeline.build, file, importsList});
webpackProcess.once('result', constants.pipeline.built, (msg) => { webpackProcess.once('result', constants.pipeline.built, (msg) => {
resulted = true;
webpackProcess.kill(); webpackProcess.kill();
return next(msg.error); return next(msg.error);
}); });