Closed adammockor closed 8 years ago
The restore option is optionnal but you have to declare it in options by setting restore to false.
So when restore option is removed from:
var excludeJade = filter(['**','!**/*.jade']);
it works without .pipe(excludeJade)
. Thank you.
Before it was strange, because sometimes it works sometimes not.
I think this issue should be re-opened.
The problem, I think, is that when the "restore" option is set to true, the task will fail silently (no return signal?) if the filter method is not actually used. ie, this will fail:
var jsFilter = G.filter('**/*.js',{restore: true});
gulp.task('ttt', ['clean:all'],function() {
"use strict";
return gulp.src(G.MBF(footFiles))
.pipe(jsFilter)
.pipe(G.debug());
});
While, this will not:
var jsFilter = G.filter('**/*.js',{restore: true});
gulp.task('ttt', ['clean:all'],function() {
"use strict";
return gulp.src(G.MBF(footFiles))
.pipe(jsFilter)
.pipe(G.debug())
.pipe(jsFilter.restore);
});
Use-case: debugging.
Sadly, the task doesn't really fail, it endlessly waits for the restore stream to be consumed. I see no proper way to avoid people messing up with the restore option that hadn't already be done (like the restore option set to false per default).
Opting in the restore option means you know what you're doing.
To be honnest, i see a way to help people debugging it but i find it pretty ugly:
Hey nfroidure, while I lack the insight to comment on the inner workings of Gulp and Node, I do agree that some sort of descriptive error message would be helpful. At the very least, such a warning should be added to the documentation.
What about adding this to the README restore option description ?
By enabling the restore stream, you declare your intent to effectively consume the restore stream. Since this module respect back pressure, your filter stream may never end if you do not consume the restored one.
I will add that now :+1:
My gulp task:
This
.pipe(excludeJade) silently exits gulp flow without error. If I add
.pipe(excludeJade.restore)` in the end of stream, everything works as expected. (OSX 10.11/Windows 7, Node 0.12.7/4.2.0)Restoration is optional according the docs.