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.
This commit is contained in:
Reilly Wood 2023-08-23 19:07:39 -07:00 committed by GitHub
parent af82eeca72
commit c8a07d477f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))