How to terminate an gulp.watch change event listener without terminating the rest of the gulp script?
Not an very elegant test case:
function paths() {
var paths = JSON.parse(fs.readFileSync('../../z/paths.json'))
gulp.watch(paths.scriptsFiles, ['test'])
return paths
}
gulp.task('test', () =>
gulp.src(paths().scriptsFiles)
.pipe(...)
.pipe(...)
)
Which leads to this error:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit