Skip to content

Commit

Permalink
Workaround for issue paulmillr#88, Windows 7, Chokidar exits with err…
Browse files Browse the repository at this point in the history
…or when remove a directory
  • Loading branch information
dkl-ppi committed Apr 1, 2014
1 parent 658c067 commit 939aa68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ FSWatcher.prototype._watch = function(item, callback) {
watcher = fs.watch(item, options, function(event, path) {
callback(item);
});
// Workaround for the "Windows rough edge" regarding the deletion of directories
// (https://github.com/joyent/node/issues/4337)
if (platform === 'win32') {
watcher.on("error", function (err) {
fs.exists(item, function (exists) {
if (exists) {
throw err;
}
});
});
}
this.watchers.push(watcher);
}
};
Expand Down

0 comments on commit 939aa68

Please sign in to comment.