Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Possible bugfix for issue #33

Refresh the fswatcher if the inode for a file has changed.
  • Loading branch information...
commit 2a51ebd600be4ddb82eb17e5ba32a11470af30a1 1 parent dbabc89
@lbv lbv authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/lib/watchr.coffee
View
9 src/lib/watchr.coffee
@@ -439,6 +439,15 @@ Watcher = class extends EventEmitter
# If we are a file, lets simply emit the change event
else
+ # If the inodes have changed, it's probably because of an "atomic save"
+ # and the watcher needs to be updated
+ if currentStat.ino isnt previousStat.ino
+ # REVIEW: Should the reason be something else?
+ @close('overwritten')
+ # REVIEW: Is this the correct way of doing it?
+ @watchSelf (err, watching) ->
+ @emit('error', err) if err or !watching
+
# It has changed, so let's emit a change event
@log('debug','determined update:',fileFullPath)
@emitSafe('change','update',fileFullPath,currentStat,previousStat)
Please sign in to comment.
Something went wrong with that request. Please try again.