-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
I want a taks to run 2 subtasks in parallel, and finish when they are both finished.
I was hoping that I could use the callback argument on gulp.start like this:
gulp.task('one', function(cb) {
console.log('one')
setTimeout(cb, 100)
})
gulp.task('two', function(cb) {
console.log('two')
setTimeout(cb, 200)
})
gulp.task('default', function(cb) {
gulp.start('one', 'two', function() {
console.log('gulp.start callback');
cb()
})
})
But the gulp.start callback is never called. Gulp quits immediately after task 'two' is done, and the default task never finishes. When I change the default task to
gulp.task('default', function(cb) {
gulp.start('one', 'two', function() {
console.log('gulp.start callback');
})
cb()
})
then the default task finishes right after starting both subtasks as expected. But then the gulp.start callback is executed after both subtasks are finished.
As another test I also tried
gulp.task('default', function() {
gulp.start('one', 'two', function() {
gulp.start('one', 'two')
})
})
This causes the subtasks to repeatedly be run, in other words, the inner gulp.start reuses the callback of the outer gulp.start.
Metadata
Metadata
Assignees
Labels
No labels