Gulp 检查运行序列是否失败

Gulp 检查运行序列是否失败,gulp,Gulp,我的gulpfile上有以下任务: gulp.task('build', function (cb) { return runSequence( 'clean', 'tsd', 'ts-lint', ['sass', 'copy-assets', 'ts-compile', 'templates', 'copy-vendor'], 'karma-once', 'index', cb ); }); 如何检查runSequence中的

我的gulpfile上有以下任务:

gulp.task('build', function (cb) {
  return runSequence(
    'clean',
    'tsd',
    'ts-lint',
    ['sass', 'copy-assets', 'ts-compile', 'templates', 'copy-vendor'],
    'karma-once',
    'index',
    cb
  );
});

如何检查
runSequence
中的任何任务是否在gulp中失败?

如果某个任务失败,则
runSequence
接受作为最后一个参数的回调函数将为您提供一个
err
对象

runSequence('mytask', ['othertask'], function(err) {
    if (err) {
        // you can check for err.message or err.task for the name of the task
    }
});

谢谢gulp中的错误处理要比grunt困难得多