notify icon indicating copy to clipboard operation
notify copied to clipboard

Wrong / duplicate events on macOS ?

Open blmhemu opened this issue 5 years ago • 2 comments

System details

  • MacOS Mojave
  • rust 1.47.0
  • notify = "5.0.0-pre.4"

What you did (as detailed as you can)

let mut watcher: RecommendedWatcher =
        Watcher::new_immediate(|res| 
        match res {
           Ok(event) => println!("event: {:?}", event),
           Err(e) => println!("watch error: {:?}", e),
        }
    ).unwrap();
watcher.watch(".", RecursiveMode::Recursive).unwrap();
touch somefile
rm somefile

What you expected

event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Remove(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }

What happened

event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Remove(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }

blmhemu avatar Nov 12 '20 16:11 blmhemu

It looks like a bug of FSEvent API. Many people reported this weird behavior. Sometimes multiple recent events on the same file may get merged into a single event.

ref: https://github.com/haskell-fswatch/hfsnotify/issues/36

PhotonQuantum avatar Nov 30 '21 18:11 PhotonQuantum