Skip to content

Commit ddd4213

Browse files
committed
fix(cleanup): close any watchers registered in options - fixes #855
1 parent fe716bb commit ddd4213

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/browser-sync.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ BrowserSync.prototype.cleanup = function (cb) {
705705
bs.events.removeAllListeners();
706706
}
707707

708+
// Close any core file watchers
709+
if (bs.watchers) {
710+
Object.keys(bs.watchers).forEach(function (key) {
711+
bs.watchers[key].watchers.forEach(function (watcher) {
712+
watcher.close();
713+
});
714+
});
715+
}
716+
708717
// Run any additional clean up tasks
709718
bs._cleanupTasks.forEach(function (fn) {
710719
if (_.isFunction(fn)) {

0 commit comments

Comments
 (0)