-
Notifications
You must be signed in to change notification settings - Fork 8
Description
If a file is created and then deleted before Hound.prototype.watch has a chance to execute, then Hound will attempt to stat a non-existent file. All other fs operations run by Hound can also fail under similar circumstances.
I was able to throw in some try-catches to fix the problem but a proper solution depends on what kind of guarantees you want to make about Hound's behavior.
If Hound must report all FS changes, however temporary, then you've got a problem. If a file is created and then deleted before Hound can stat the file, it'll have to fire a 'create' event without any stat data, followed by a 'delete' event.
It's easier if you only require Hound to fire enough events that an observer arrives at a valid view of the eventual steady-state of the filesystem. In other words, if a file is created and then immediately deleted, Hound doesn't need to fire any events. "oops, it was too fast." Of course, if a file is created and remains extant then Hound is required to fire a 'created' event. If the file is modified twice in quick succession, Hound can get away with firing only one 'change' event, provided that event fires after the second file change has completed. For my personal use-case (automatically rebuilding templates & recompiling code as I edit them) this is totally fine.