Closed
Description
When a task is (e.g. accidentally) listed more than once in a 'batch' to run-sequence, gulp silently exits (with exit code 0) without running other tasks after that batch.
To reproduce, try running the following using gulp test
:
var gulp = require('gulp');
var runSequence = require('run-sequence');
gulp.task('test', function(callback) {
runSequence(['a','a'], 'b', callback);
});
gulp.task('a', function() {
console.log('a');
});
gulp.task('b', function() {
console.log('b');
});
This leads to the following output:
[16:52:12] Using gulpfile c:\Source\testje\gulpfile.js
[16:52:12] Starting 'test'...
[16:52:12] Starting 'a'...
a
[16:52:12] Finished 'a' after 180 μs
Whereas the following would be expected:
[16:52:59] Using gulpfile c:\Source\testje\gulpfile.js
[16:52:59] Starting 'test'...
[16:52:59] Starting 'a'...
a
[16:52:59] Finished 'a' after 174 μs
[16:52:59] Starting 'b'...
b
[16:52:59] Finished 'b' after 125 μs
[16:52:59] Finished 'test' after 3.98 ms
One way to fix this, would be to change the if (idx > -1)
in the onTaskEnd()
function to e.g. while ((idx = currentTaskSet.indexOf(event.task)) > -1)
.