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

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

Open
sxyazi opened this issue Jul 21, 2024 · 1 comment

Comments

@sxyazi
Copy link

sxyazi commented Jul 21, 2024

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: Permanently deleting folder crashes on Windows sxyazi/yazi#1320 (comment)
  • 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
Copy link
Author

sxyazi commented Jul 21, 2024

Oh I found a related PR here #602

But it seems not included in the latest release, is it possible to create a patch version for it?

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