From e19ee1f5581700fa32329e74b357607f2b5eac0c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 9 Jul 2018 13:50:03 -0400 Subject: [PATCH 1/2] log error when pipeline dies --- lib/pipeline/pipeline.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 16d37f6ab..31b971852 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -101,15 +101,25 @@ class Pipeline { // JS files async.waterfall([ function runWebpack(next) { + let resulted = false; const webpackProcess = new ProcessLauncher({ modulePath: utils.joinPath(__dirname, 'webpackProcess.js'), 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.build, file, importsList}); webpackProcess.once('result', constants.pipeline.built, (msg) => { + resulted = true; webpackProcess.kill(); return next(msg.error); }); From 06a694817381382f0681cdd255f7b656e0805c6e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 9 Jul 2018 14:26:10 -0400 Subject: [PATCH 2/2] rename to built --- lib/pipeline/pipeline.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 31b971852..d86253487 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -101,13 +101,13 @@ class Pipeline { // JS files async.waterfall([ function runWebpack(next) { - let resulted = false; + let built = false; const webpackProcess = new ProcessLauncher({ modulePath: utils.joinPath(__dirname, 'webpackProcess.js'), logger: self.logger, events: self.events, exitCallback: function (code) { - if (!resulted) { + if (!built) { return next(`File building of ${file.filename} exited with code ${code} before the process finished`); } if (code) { @@ -119,7 +119,7 @@ class Pipeline { webpackProcess.send({action: constants.pipeline.build, file, importsList}); webpackProcess.once('result', constants.pipeline.built, (msg) => { - resulted = true; + built = true; webpackProcess.kill(); return next(msg.error); });