shama / gaze

:crystal_ball: A globbing fs.watch wrapper built from the best parts of other fine watch libs.
MIT License
1.16k stars 167 forks source link

Incomplete and/or erronous implementation of "renamed" event #55

Open fnk opened 10 years ago

fnk commented 10 years ago

When i rename a watched file "a.txt" to "b.txt" i receive following events in this order:

deleted(a.txt) renamed(undefined, b.txt)

Also, in README.md, the "Usage" passage does not handle "renamed" and the "Events" passage shows an invalid method signature for "renamed"

cheers, andi.

Update: My environment is: Win 7, Node 0.8.3, npm 1.1.43, gaze 0.4.2

shama commented 10 years ago

Node 0.8.3 is very old. Could you update to the latest v0.8 release or even better, upgrade to the latest node v0.10 and try again? Thanks!

fnk commented 10 years ago

I will get back to you on this next week. Currently i have no access to the environment and do not know if we can upgrade there to a newer version.

Thanks, Andi.

nojhamster commented 10 years ago

Hi guys ! I ran into a similar issue with node 0.10.18 and 0.10.21 on Ubuntu 12.04. Renaming a file results in a deleted event and it's not watched anymore after that. (in my case there's no renamed event)

seebees commented 10 years ago

can confirm in 0.10.25. If the file is within the watch pattern e.g. **/*.log and you mv asdf.log qwer.log you will receive a deleted event followed by a rename. I think that the deleted event is in error.

On the other hand, if you have a very restrictive pattern say asdf.log and again you mv asdf.log qwer.log you will only receive a deleted event.

I think that in both cases, only the rename should be raised. Though making the second case work may be hard...

ipatalas commented 7 years ago

Hi,

It doesn't seem to be an issue related to node.js version. I have the same behavior on v6.5.0. Getting deleted followed by rename which makes me to workaround the situation and delay deletes if they weren't really deletes to be able to cancel them in rename event. My pattern is very loose, matching both names before and after rename.