task not waiting for dependency to finish
See original GitHub issueShouldn’t this work?
var gulp = require('gulp');
var del = require('del');
...
gulp.task('clean', function(callback) {
del([ site.build + '/**' ], callback);
});
gulp.task('build', [ 'clean' ], function() {
return gulp.start('html', 'less', 'js', 'png', 'jpg');
});
gulp.task('deploy', [ 'build' ], function() {
...
});
Unfortunately deploy
runs before build
finished.
gulp.task('clean', function(callback) {
del([ site.build + '/**' ], callback);
});
gulp.task('build', [ 'clean', 'html', 'less', 'js', 'png', 'jpg' ], function() {
});
gulp.task('deploy', [ 'build' ], function() {
...
});
The above does not work either as clean
is run in parallel.
So what’s the suggested way of doing this?
Issue Analytics
- State:
- Created 9 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Waiting for task to be finished - Stack Overflow
In the above code, I have written Task1.wait() which waits for task1 to be finished but not for all the tasks created in...
Read more >Just because you stopped waiting for it, doesn't mean the Task ...
Without special handling, a Task always run to completion. Let's start by looking at what happens to the "source" Task when you use...
Read more >How to describe the "waiting time" as someone else has yet to ...
Try 'dependency'. – Tushar Raj. Jul 1, 2016 at 6:34.
Read more >Finish-to-finish dependency explained by example
Finish-to-finish (FF) means that one task can only be completed after the other task has been completed.
Read more >Wait for the execution of a task to complete before running ...
All of those printlns are executing at “configuration time” instead of “execution time”, so task dependencies aren't taken into account at that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Even with run-sequence, I was having the same problem. Here’s how I worked around it:
Met same issue here. Let’s say there are 2 tasks, First and Second. Second runs after First. The First task generates some files, which are to be read by the Second task. Using dependency doesn’t make sure the Second task can find the files generated.
I have to explicitly using the
done
callback on the pipeline to let Second only starts after First truly done.Without the
done
trick, the Second never finds the files generated by First. Below shows what I tried, the Second task can find the files generated by callinggulp First
by hand, and then callinggulp Second
subsequently.