AgentCosmic / xnotify

Cross platform file notification with built-in task execution and a client/server feature to overcome virtual folders without relying on polling.
MIT License
47 stars 6 forks source link

When the file changes, the event is dispatched 4 times. #5

Closed LordKino closed 3 years ago

LordKino commented 3 years ago

Version 0.2.4, windows amd64 When the file changes, the event is dispatched 4 times.

.\xnotify.exe --verbose --client 192.168.56.101:8090 -i . -e "(vendor|.git)$"

output: ...... [xnotify] Watching: C:\localhost\laravel\xnotify.exe write rsync.sh write rsync.sh write rsync.sh write rsync.sh

AgentCosmic commented 3 years ago

What's writing the file? Some text editors make multiple writes when you save. You can try modifying the file via cli to see if it still happens.

LordKino commented 3 years ago

Netbeans, Notepad++ with same result

AgentCosmic commented 3 years ago

I've not used those before. But have you tried writing to a file via cli? If that only trigger once then it's probably the editor that's writing multiple times.

LordKino commented 3 years ago

Tried Vim: ........ [xnotify] Watching: C:\localhost\laravel\xnotify.exe

write rsync.sh write rsync.sh~ write rsync.sh write rsync.sh~ write rsync.sh write .rsync.sh.swp

AgentCosmic commented 3 years ago

Yeah look like it's working fine since the .swp file is triggering only once. It'll be better if you can do something like echo 123 > file.txt to be sure.

LordKino commented 3 years ago

Yes, 1 line:

Write file.txt

AgentCosmic commented 3 years ago

👍 There's nothing much I can do about editors triggering multiple write events. You can try using the --batch option. I'll close the issue.