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

Ability to unwatch a file. #63

Open
mark-e-hoffman opened this issue Dec 14, 2022 · 2 comments
Open

Ability to unwatch a file. #63

mark-e-hoffman opened this issue Dec 14, 2022 · 2 comments

Comments

@mark-e-hoffman
Copy link

Hi, I'm using your library to tail/watch multiple log files in a directory and its child directories.
Everything is working well, except that it appears that the library is not closing its file handle on the watched file whenever the process actually writing to the log file closes it.

I see that if a file is removed it will be unwatched but I only want it to be unwatched when it's Closed.
My code is also using notify so I can have a finer grain control of file events. Whenever I see a Close EventKind on a file that I'm tailing, I want to be able to "unwatch" it. There is an unwatch function on the MuxLines but it's not public.

Thanks

@jmagnuson
Copy link
Owner

Exposing the unwatch API would be a nice addition! I think the main question would be, does it require the exact Path that was internally canonicalized, or does it internally canonicalize and hope for a match.

Removing on close is also interesting, could you elaborate on the use-case? Currently, file closure causes the file watch to be put into a pending state, so the two cases would need to coexist somehow.

@mark-e-hoffman
Copy link
Author

mark-e-hoffman commented Dec 19, 2022 via email

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

No branches or pull requests

2 participants