catch unhandled promise rejections in build

This commit is contained in:
Joao Moreno 2017-01-13 09:12:06 +01:00
parent 2cdc2b3da8
commit 5ba8940d62
2 changed files with 11 additions and 0 deletions

View file

@ -229,6 +229,11 @@ gulp.task('hygiene', () => hygiene());
if (require.main === module) {
const cp = require('child_process');
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
process.exit(1);
});
cp.exec('git config core.autocrlf', (err, out) => {
const skipEOL = out.trim() === 'true';

View file

@ -58,8 +58,14 @@ var ALL_EDITOR_TASKS = [
'tslint',
'hygiene',
];
var runningEditorTasks = process.argv.length > 2 && process.argv.slice(2).every(function (arg) { return (ALL_EDITOR_TASKS.indexOf(arg) !== -1); });
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
process.exit(1);
});
if (runningEditorTasks) {
require(`./build/gulpfile.editor`);
require(`./build/gulpfile.hygiene`);