How to get task name inside task in gulp

gulp, javascript

Solution

gulp.Gulp.prototype.__runTask = gulp.Gulp.prototype._runTask;
gulp.Gulp.prototype._runTask = function(task) {
  this.currentTask = task;
  this.__runTask(task);
}

gulp.task("someTask", function(){
  console.log( this.currentTask.name );
}

Problem

I'm using gulp-plumber + gulp-notify and want to put task name in gulp-notify as a title. following is the code i wrote, thanks in advance. ``` gulp.task('SOMETASK', function() { return gulp.src(sourcePaths) .pipe(plumber({errorHandler: notify.onError({ message: "<%= error.message %>", title: "I WANT TO PUT TASK NAME HERE" })})) // omitted below }); ```

Original source