-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fails on return #8
Comments
Thank you! But while I was writing a test for it, it turns out, that without plumber I got same behavior (not working, when returning a stream). Could you remove plumber and check this too? If so, this issue related with orchestrator. |
I'm seeing this behavior but only when my stream uses the gulp-sass plugin. I throw an error in the stream and plumber notifies me, but the watch task for sass stops completely. I also tried returning a promise instead of the stream, and using a callback instead of returning a stream. Neither of those worked either. However, my coffeescript task works fine. I make an error there and I'm notified, but the watch task continues and I can fix the error without restarting gulp. |
I've just discovered gulp-sass' propensity to kill my watch, as well. It's easy enough to have one syntax error from a designer and the whole thing blows up. I've figured out how to handle it. Basically, you pass plumber a custom error handler. That error handler logs the problem (I just copied plumber's default handlers log message, plus a few key newlines)... and then your function closes down the watch that is now defunct. (I keep track of the gulp-watch object and my connect servers, all of which have a close function, so I call that on each of them) Then the function reinvokes the watcher function that I use to initiate the watch in the first place ,along with a message saying that I'm doing so. It actually works out pretty well. It just takes managing the state of a few things in order to end the current watch and start up a new one in good health. I have it set up so that it doesn't matter which plugin crashes the party, this behavior will kick in if plumber's patch detects and prevents me from the China syndrome. |
So you're restarting gulp watch in the Could you show us some source of it ? |
I had same issue with gulp-stylus. Emitting gulp.task('styles', function() {
return gulp.src(paths.styles.src)
.pipe(plumber(function(error) {
gutil.log(gutil.colors.red(error.message));
this.emit('end');
}))
.pipe(stylus({ use: [ nib() ] }))
.pipe(concat('all.css'))
.pipe(gulp.dest(buildDir + '/styles'));
}); |
@jtomaszewski my project is scheduled to go open source later this year and I'm not in control of that schedule. I'd organize a snippet for you, but I think @heikki's method makes more sense. I knew that my problem was the lack of an end event because it was obvious that watch didn't think its handler was completing, but it didn't occur to me to emit |
+1 @heikki |
@heikki 👍 |
@heikki 👍 |
Insane, this is really annoying, why does not plumber catch this or less/sass plugins automatically close pipe on error? That seems odd.. Why would plumber exist if I can add |
gulp-sass has a configurable onError handler which works for me (unless node-sass segfaults, which I hope is a thing of the past). |
@pronebird when you have long pipeline - then you must add We started to use |
@floatdrop thanks for explanation. I encounter this error on Do you think it would make sense to fix plumber to close pipe on error by default? |
@pronebird well, plumber purpose is to keep pipes working on errors. If you want to close pipe on errors - I think you should not use plumber at all. |
How do I close pipe on errors? I'm experiencing this on |
@fbm-static call |
^ That may not be the right thing even if it seems to work ok. |
@heikki when I do |
I'm having the same problem with gulp-compass, but calling |
this.emit('end') isn't working for me either. After skimming the article referenced by heikki, I modified my code to the following which does work:
Note: I'm setting isWatched within my watch task because I really only want plumber to kick in when I'm watching stuff, not during my CI build. |
@heikki Thank you! |
…rors. Seems like I came across [this issue](floatdrop/gulp-plumber#8).
Hey there!
AWESOME 🐒 patch, love it so much!
I noticed if I return the stream in a task, 'watch' freezes after a stream error:
If I remove 'return' it doesn't freeze, when an error occurs:
Returning the stream is mentioned in the gulp docs here:
https://github.com/gulpjs/gulp/blob/master/docs/API.md#async-task-support
Thanks! :)
The text was updated successfully, but these errors were encountered: