Skip to content

Commit

Permalink
ensure bundle errors return error exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 5, 2014
1 parent 4f18299 commit a7826d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ process.on('uncaughtException', function(err) {
var bArgs = options.args.splice(1);

if (bArgs.length < 2) {
bundle.bundle(bArgs[0], undefined, inject);
bundle.bundle(bArgs[0], undefined, inject)
.catch(function(e) {
process.exit(1);
});
}
else {
var secondLastArg = bArgs[bArgs.length - 2].trim();
Expand All @@ -292,15 +295,21 @@ process.on('uncaughtException', function(err) {
expression = bArgs.splice(0, bArgs.length - 1).join(' ');
fileName = bArgs[bArgs.length - 1];
}
bundle.bundle(expression, fileName, inject);
bundle.bundle(expression, fileName, inject)
.catch(function(e) {
process.exit(1);
});
}
break;

case 'bundle-sfx':
var options = readOptions(args, ['--yes']);
if (options.yes)
ui.useDefaults();
bundle.bundleSFX(args[1], args[2]);
bundle.bundleSFX(args[1], args[2])
.catch(function(e) {
process.exit(1);
});
break;

case 'build':
Expand Down
2 changes: 2 additions & 0 deletions lib/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ exports.bundle = function(moduleExpression, fileName, inject) {
})
.catch(function(e) {
ui.log('err', e.stack || e);
throw e;
});
}

Expand All @@ -156,5 +157,6 @@ exports.bundleSFX = function(moduleName, fileName) {
})
.catch(function(e) {
ui.log('err', e.stack || e);
throw e;
});
}

0 comments on commit a7826d1

Please sign in to comment.