-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Silent gulp exit on duplicate tasks #13
Comments
Wow, that's a great find. I'm trying to decide if it makes sense to:
I'm actually leaning to throwing the error. If someone meant: I can also check for it during the verification stage. Any opinion? |
Yeah, throwing an error during the verification stage is probably the best solution. One could always write a function to de-duplicate the input to run-sequence (e.g. in case of auto-generated targets), so it makes sense to stay on the safe side for the 'normal' case. |
All set, thank you for finding this and for your feedback! |
Note: you'll have to bump your major version of |
Thanks for your very quick fix! I'll be updating tomorrow. |
I am not sure why you don't allow to duplicate tasks. Make it at least optional. the first build is only test (for sure that all compiled) |
@Delagen You can still do this outside of a single sequence by creating a separate task and using normal task dependencies. I don't think that's a strong enough use case vs being more likely that the task was entered in error. You can also stay on the previous version of |
Btw: I tested the fix, and it works like a charm! I didn't check it, but like @Delagen, I was also expecting the check to only be applied to each 'parallel' member only, so: This is in correspondence with the fact that gulp (and runSequence) correctly schedules these tasks, Example gulpfile: var gulp = require('gulp');
var runSequence = require('run-sequence');
gulp.task('test', ['x', 'y']);
gulp.task('x', function(callback) {
runSequence('a', 'b', 'a', callback);
});
gulp.task('y', function(callback) {
runSequence('a', 'b', 'a', callback);
});
gulp.task('a', function(callback) {
console.log('a');
setTimeout(callback, 100);
});
gulp.task('b', function(callback) {
console.log('b');
setTimeout(callback, 100);
}); Expected output:
Note how the a-b-a sequence is in fact run just once, although both x and y independently start such a sequence. I personally haven't needed this yet, but @Delagen's case sounds reasonable. |
Well, it's a relatively easy fix. I guess I don't really care, either way. I can push out a change in a couple of minutes. |
OK, I pushed a fix out as 1.0.1, which allows duplication of a task as long as it is not within the same parallel set (array). Sorry @Delagen. I hope this solution works for you. |
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
:This leads to the following output:
Whereas the following would be expected:
One way to fix this, would be to change the
if (idx > -1)
in theonTaskEnd()
function to e.g.while ((idx = currentTaskSet.indexOf(event.task)) > -1)
.The text was updated successfully, but these errors were encountered: