notify icon indicating copy to clipboard operation
notify copied to clipboard

Bug: Crashes on Windows when the watched directory no longer exists in release mode

Open sxyazi opened this issue 1 year ago • 1 comments

System details

  • OS/Platform name and version: Windows
  • Rust version (if building from source): rustc --version: rustc 1.79.0 (129f3b996 2024-06-10)
  • Notify version (or commit hash if building from git): 6.1.1
  • If you're coming from a project that makes use of Notify, what it is, and a link to the downstream issue if there is one: https://github.com/sxyazi/yazi/issues/1320#issuecomment-2241556624
  • Filesystem type and options: NTFS
  • On Linux: Kernel version:
  • On Windows: version and if you're running under Windows, Cygwin (unsupported), Linux Subsystem: Windows 11 23H2 (22631.3880)
  • If you're running as a privileged user (root, System):
  • If you're running in a container, details on the runtime and overlay:
  • If you're running in a VM, details on the hypervisor:

What you did (as detailed as you can)

  1. Watch directory a
  2. Delete directory a
  3. Build and run in release mode (important)
  4. The app crashes

What you expected

Not crashes

What happened

I can reproduce it with the following code through cargo run --release on Windows:

fn main() {
  let p = Path::new("C:\\Users\\ika\\Desktop\\abc");
  std::fs::create_dir(p).unwrap();

  let mut watcher = ::notify::RecommendedWatcher::new(|_| {}, Default::default()).unwrap();
  watcher.watch(p, ::notify::RecursiveMode::NonRecursive).unwrap();

  // Try to comment on this line you'll see "Exited successfully" printed normally
  std::fs::remove_dir_all(p).unwrap();

  std::thread::sleep(Duration::from_secs(5));
  println!("Exited successfully");
}

Error message:

error: process didn't exit successfully: `target\release\test.exe` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)

sxyazi avatar Jul 21 '24 10:07 sxyazi