How to abort if command fails in Unix shell? How to abort if command fails in Unix shell? shell shell

How to abort if command fails in Unix shell?


This looks like a gulp question, rather than a shell question. As gulp completes successfully (i.e. reaches an exit without raising an error), it doesn't tell the shell that anything is wrong. The best way to address this is to reconfigure gulp to interpret lint failures as errors.

Could you post your gulpfile.js? Specifically your tslint task.

It probably looks like

gulp.task('tslint', function() {    gulp.src("**/*.ts")        .pipe(tslint.report('prose'))});

You can instruct your reporter to fail on error by changing this to:

gulp.task('tslint', function() {    gulp.src("**/*.ts")        .pipe(tslint.report('prose', {emitError: true}))});

edit: look at the gulp-tslint README for more details on emitError