Fix watch not handling all file changes (#9990)

Closes https://github.com/nushell/nushell/issues/9910

I noticed that`watch` was not catching all filesystem changes, because
some are reported as `ModifyKind::Data(DataChange::Any)` and we were
only handling `ModifyKind::Data(DataChange::Content)`. Easy fix.

This was happening on Ubuntu 23.04, ext4.
This commit is contained in:
Reilly Wood 2023-08-12 14:34:40 -07:00 committed by GitHub
parent e77a0a48aa
commit 7b1c7debcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,7 +251,8 @@ impl Command for Watch {
.pop()
.map(|path| event_handler("Remove", path, None))
.unwrap_or(Ok(())),
EventKind::Modify(ModifyKind::Data(DataChange::Content)) => one_event
EventKind::Modify(ModifyKind::Data(DataChange::Content))
| EventKind::Modify(ModifyKind::Data(DataChange::Any)) => one_event
.paths
.pop()
.map(|path| event_handler("Write", path, None))