-
Notifications
You must be signed in to change notification settings - Fork 215
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
Deleting the watched repository in Linux creates an event but does not in Windows #403
Comments
My guess is that the windows file API simply does not emit events for that case, while on linux it does. Would be interesting to test for this on the other Systems. I did a short search through the docs but I couldn't find anything obvious. |
Ok I found something and it's not fun: To summarize:
I'd propose we simply document this behavior and one should watch the parent directory. Edit to clarify: We simply won't get top-level deletion events on windows. |
Thanks for looking into this! I definitely think that documenting the behavior and the parent directory workaround is a good idea. It seems there are some solutions like the ones listed in that stackoverflow answer. In notify's case it could be some separate thread that occasionally polls the watched directory using |
fyi: behaviour is documented and links to this issue for now |
System details
Linux (WSL2):
Windows 11:
21H2 (OS Build 22000.675)
Rust (on both systems):
rustc 1.60.0 (7737e0b5c 2022-04-04)
Notify (on both systems):
notify = "5.0.0-pre.15"
DirectoryMonitor
doesn't shut down on Windows on removal of watched dir microsoft/onefuzz#1850What you did (as detailed as you can)
b
(Linux:mkdir b
, Windows:New-Item b -ItemType "directory"
)b
(I posted the code below as a minimal repro)b
(Linux:rmdir b
, Windows:Remove-Item b
)Ok(Event { kind: Remove(File), paths: ["b"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None })
but on Windows, no event is createdWhat you expected
The behavior should be consistent across both Linux and Windows. Either both should receive the directory delete event or neither.
What happened
Only the Linux implementation receives the folder delete event.
The text was updated successfully, but these errors were encountered: