Skip to content

Commit

Permalink
Merge pull request #135 from callumlocke/master
Browse files Browse the repository at this point in the history
Prevent race condition (fixes #134)
  • Loading branch information
shama committed Jul 10, 2014
2 parents c418a39 + 9747a56 commit 34fa0d3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/gaze.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,14 @@ Gaze.prototype._wasAdded = function(dir) {
}
helper.forEachSeries(current, function(file, next) {
var filepath = path.join(dir, file);
if (!fs.existsSync(filepath)) return next();
var stat = fs.lstatSync(filepath);
var stat;
try {
stat = fs.lstatSync(filepath);
}
catch (err) {
if (err.code === 'ENOENT') return next();
throw err;
}
if ((dirstat.mtime - stat.mtime) <= 0) {
var relpath = path.relative(self.options.cwd, filepath);
if (stat.isDirectory()) {
Expand Down

0 comments on commit 34fa0d3

Please sign in to comment.