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

[Windows] No events reported from symlinked subdirectories when watching recursively #629

Open
Bash-09 opened this issue Aug 7, 2024 · 0 comments

Comments

@Bash-09
Copy link

Bash-09 commented Aug 7, 2024

System details

  • OS/Platform name and version: Windows 11 23H2
  • Rust version (if building from source): rustc --version: 1.79.0
  • Notify version (or commit hash if building from git): 6.1.1

All drives involved were NTFS

This does not seem to occur on Linux, on Linux this behaves as expected.

What you did (as detailed as you can)

Minimal script to reproduce:

use std::{path::PathBuf, time::Duration};
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};

fn main() {
    let mut watcher: RecommendedWatcher = Watcher::new(
        Box::new(move |res: Result<Event, notify::Error>| match res {
            Ok(event) => {
                println!("Event: {event:?}");
            }
            Err(e) => {
                println!("Error: {e}");
            }
        }),
        Config::default().with_poll_interval(Duration::from_secs(1)),
    )
    .unwrap();

    watcher
        .watch(&PathBuf::from("."), RecursiveMode::Recursive)
        .unwrap();

    loop {}
}

Inside the project directory I created a symlink called test_dir that points to another folder, and the script began watching the project directory recursively. When creating files inside the symlinked folder, no events were reported. If the script was modified to watch the symlinked directory directly instead of the parent folder (the project folder), then it would pick up events when creating files inside the symlinked directory.

I would have expected the files being created inside the symlinked subdirectory to create events, which is what happens on Linux.

(Shown below is the above script (with some additional print statements) running, watching the current directory. The current directory contains a symlink to test_dir, where files are being created and destroyed, however no events are being printed)
1723034161

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

1 participant