Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watching files #32

Open
neko-kai opened this issue Apr 13, 2013 · 10 comments
Open

Watching files #32

neko-kai opened this issue Apr 13, 2013 · 10 comments

Comments

@neko-kai
Copy link

The library is marketed as "Cross platform library for file creation, modification, and deletion notification", yet there is no function to watch a single file.

@gregwebs
Copy link
Member

the latest code on github has already been modified to support deletion but needs to be tested out

@mdittmer
Copy link
Contributor

Is the issue support for deletion, or support for watching a particular file name rather than files in a particular directory (optionally: and its subdirectories)?

@neko-kai
Copy link
Author

@mdittmer
Second.

@nh2
Copy link

nh2 commented Feb 11, 2014

Yes, watching single files would be very useful.

Do the underlying OS APIs allow this on non-Linux platforms?

@gregwebs
Copy link
Member

I think FSEvents only watches directories, but @feuerbach was looking at adding a kqueue backend.

@UnkindPartition
Copy link
Member

@nh2 an important question to answer is whether you want to watch a path or an inode.

Some OSes allow watching inodes, but I don't know any that allow watching paths. And watching paths is most probably what you need.

I outlined a way to watch paths in #41.

@nh2
Copy link

nh2 commented Feb 11, 2014

@feuerbach I use it to watch my own executable in my selfrestart package and restart it when it changes (https://github.com/nh2/selfrestart/blob/94cb8e75f4ccbfa993a4a56e15c08d10ce8b10c3/System/SelfRestart.hs#L47).

I guess whether I want to watch a file or an inode depends on how my change of executable is being written - if it's deleted and re-created, watching the inode will probably not work.

@UnkindPartition
Copy link
Member

Exactly. Watching an inode is very fragile, and I have a hard time coming up with an example where one would prefer watching the inode to watching the path.

@mhitza
Copy link

mhitza commented May 3, 2015

I would like to have this feature in as well, that way I could use hfsnotify in a cross OS way instead of relying on hinotify

@LeifW
Copy link

LeifW commented Nov 25, 2015

Currently I'm thinking of doing this just by making the predicate check the filename. Sometimes things get into trouble when it watches more than it should, e.g. broken symlinks some apps create in /tmp.

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

No branches or pull requests

8 participants