I have multiple Gulp tasks that send a series of commands to the shell. The second task is dependent on the first. How do make ensure all commands sent to async.series in the first task are complete before the second task is executed.
gulp.task('task1', function(cb) {
process.chdir(__dirname);
process.chdir('path');
var cmdArray = getCmdsForTask1();
runSeries(cmdArray, 'Task 1');
return cb();
});
gulp.task('task2',['task1'], function() {
process.chdir(__dirname);
process.chdir('task2_path');
var cmd2 = getCmdForTask2();
runSeries([cmd2], 'Task 2');
});
var runSeries = function(cmdArray, taskName) {
async.series(cmdArray, function(err, results) {
results.forEach( function(result) {
gutil.log(gutil.colors.cyan(taskName + ' complete:') + gutil.colors.white(result) );
});
});
};
Thanks Much!