Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Is it possible to watch a single file? #94

Closed
mstum opened this issue Mar 23, 2014 · 1 comment
Closed

Is it possible to watch a single file? #94

mstum opened this issue Mar 23, 2014 · 1 comment

Comments

@mstum
Copy link

mstum commented Mar 23, 2014

I want to use fsnotify as a Configuration-file hot reloader. The configuration file may be in a directory with many other files (e.g., /etc on Linux).

I don't know if the underlying operating systems support it, but is it possible to only watch a single file? (I'm right now filtering the ev.Name with string.HasSuffix which works for me, just wondering if the watcher itself can be simplified to keep load as low as possible)

Setting up the watcher with watcher.Watch("/etc/myconfig.conf") works, but also catches events on a file called myconfig.conf~ like the temp files greated by vim.

@mstum
Copy link
Author

mstum commented Mar 23, 2014

I saw saw the remarks on #37 and that also just explained an issue I'm troubleshooting - when I use vim - vim creates a temp file, deletes the original and renames the temp file and I was wondering why fsnotify wasn't firing after that. Now I know that I lose my watch when the watched file/folder is deleted :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant