What were you expecting to happen?
If I run gulp watch with the following gulpfile and edit test.html by adding and removing whitespace, the "styles" task should take a similar amount of time every time the watcher fires
What actually happened?
Task takes longer every time it is run

Gulpfile
let gulp = require('gulp');
let rename = require('gulp-rename');
function styles() {
return gulp.src('src/**/*.scss')
//Issue happens with or without this rename plugin
.pipe(rename({extname: '.test'}))
//Issue only happens if destination directory is same as source directory
.pipe(gulp.dest('src'));
}
gulp.task('watch', function() {
//only happens if there is a glob here
gulp.watch('src/**/test.html', styles);
});
What version of gulp are you using?
CLI version 1.2.2
Local version 4.0.0-alpha.2
What versions of npm and node are you using?
node: v7.2.0
npm: 3.10.9
OS: Windows 10
Zipped version of an app that reproduces the issue
gulp-issue.zip
Does this happen if you use chokidar directly? It'll be hard to test (you need to add stream completion timing around it) but it would help narrow this down. None of us have Windows to test this.
Not sure how to test that but I'll try to find some time to learn more about it and test it out
Similar (windows only) issue → https://github.com/paulmillr/chokidar/issues/328
Tried to reproduce on windows 10, [email protected] using https://github.com/nolanlawson/marky for timing. Tried a list of absolute paths, then **/*.js. Build times fluctuated between ~300ms and ~450ms, but they didn't increase over 18 rebuilds. Sorry, I was hoping I'd be able to confirm the issue, let me know if you'd like anything else tested on a windows box.
@ansballard I don't think it can be achieved with that module. It's not a blocking operation. We have special logic that tracks completion of an async task (listening for the end of the returned stream).
I tried adding {usePolling: true} to gulp.watch() and that "fixed" the issue. Not sure if that helps narrow it down.
@robianmcd based on that, I think this is an issue in chokidar (the issue already referenced). If you agree, please jump on that issue and close this one (since it's not something we control).
@phated Sorry, didn't explain how I'm running the tasks. I'm calling the tasks via gulp.task("taskname")(args).then(result => ..., and the promise returned form the task is called from the finish event of the stream. But either way it doesn't reproduce the bug, so I'll keep my head down 馃槉
@phated Yeah makes sense. I'll add my comments there
It is the recursive ** that causes this.
gulp.watch('src/*.html', styles); should fix it.
Most helpful comment
I tried adding
{usePolling: true}togulp.watch()and that "fixed" the issue. Not sure if that helps narrow it down.