From d8d7542f58046f15d88795e3c48f952f54a02c3c Mon Sep 17 00:00:00 2001 From: Contra Date: Thu, 26 Jun 2014 23:37:20 -0700 Subject: [PATCH] use exit code 1 when a task fails --- bin/gulp.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/gulp.js b/bin/gulp.js index 7bf6f385b..acf025267 100755 --- a/bin/gulp.js +++ b/bin/gulp.js @@ -23,6 +23,14 @@ var cli = new Liftoff({ extensions: interpret.jsVariants }); +// exit with 0 or 1 +var failed = false; +process.once('exit', function(code) { + if (code === 0 && failed) { + process.exit(1); + } +}); + // parse those args m8 var cliPackage = require('../package'); var versionFlag = argv.v || argv.version; @@ -159,7 +167,9 @@ function formatError(e) { function logEvents(gulpInst) { // total hack due to fucked up error management in orchestrator - gulpInst.on('err', function () {}); + gulpInst.on('err', function () { + failed = true; + }); gulpInst.on('task_start', function (e) { // TODO: batch these