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

Simple example from documentation doesn't work #576

Open
osenvosem opened this issue Mar 19, 2024 · 2 comments
Open

Simple example from documentation doesn't work #576

osenvosem opened this issue Mar 19, 2024 · 2 comments

Comments

@osenvosem
Copy link

MacOS 13.6, notify 6.1.1

The code executed inside a sync main function. Nothing happens, no errors or output in console when creating/changing/deleting files in the watched folder.

Value of the sync_dir variable is "/Users/srg/conf_sync"

    let mut watcher = notify::recommended_watcher(|res| match res {
        Ok(event) => println!("event {:?}", event),
        Err(err) => println!("error {:?}", err),
    })
    .expect("Error creating watcher");

    watcher
        .watch(Path::new(&sync_dir), RecursiveMode::Recursive)
        .expect("Error start watcher");
@vitali2y
Copy link

Linux Mint 21.2, notify 6.1.1: simple example just exits with 0 exit code, nothing happens.

@dsincl12
Copy link

Add use std::thread; and then the following lines before Ok(()):

println!("Watcher is running. Press Ctrl+C to exit.");

thread::park();

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

3 participants