From c8a07d477f358dcf56c5a2b7d5edcf39aa59ced6 Mon Sep 17 00:00:00 2001 From: Reilly Wood <26268125+rgwood@users.noreply.github.com> Date: Wed, 23 Aug 2023 19:07:39 -0700 Subject: [PATCH] Fix watch not detecting modifications on Windows (#10109) Closes #9910 FOR REAL this time. I had fixed the issue on Linux but not Windows. Context: https://github.com/nushell/nushell/issues/9910#issuecomment-1689308886 I've tested this PR successfully on Windows, Linux, and macOS by running `watch . {|a,b| print $a; print $b}` and confirming that it prints once when I change a file in the current directory. --- crates/nu-command/src/filesystem/watch.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/filesystem/watch.rs b/crates/nu-command/src/filesystem/watch.rs index 22f22c0976..00eabce86b 100644 --- a/crates/nu-command/src/filesystem/watch.rs +++ b/crates/nu-command/src/filesystem/watch.rs @@ -252,7 +252,8 @@ impl Command for Watch { .map(|path| event_handler("Remove", path, None)) .unwrap_or(Ok(())), EventKind::Modify(ModifyKind::Data(DataChange::Content)) - | EventKind::Modify(ModifyKind::Data(DataChange::Any)) => one_event + | EventKind::Modify(ModifyKind::Data(DataChange::Any)) + | EventKind::Modify(ModifyKind::Any) => one_event .paths .pop() .map(|path| event_handler("Write", path, None))