Skip to content

Hotwatch doesn't detect changes to file which are done while the handler callback is active #9

@hoerman

Description

@hoerman

Hotwatch doesn't seem to detect changes done to files, which are done while a watch callback is running

let mut watch = Hotwatch::new().unwrap();

watch.watch("/tmp/test123", |e| {
    println!("{:?}", e);
    std::thread::sleep(Duration::from_secs(10));
}).unwrap();

Run this code an do an "echo >> /tmp/test123" once, and than a second time short after the debug printout appears. Hotwatch will only detect the first change to the file. The same happens with the blocking Variant of the module. Tested with Linux.

The behavior results in some possible race conditions, when one want's to be sure to always use the latest revision of the given file. At least this behavior should be noted in the module documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions