Skip to content

Commit

Permalink
catch unhandled promise rejections in build
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jan 13, 2017
1 parent 2cdc2b3 commit 5ba8940
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/gulpfile.hygiene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
6 changes: 6 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down

0 comments on commit 5ba8940

Please sign in to comment.