From 9d6da1036d80a29862f6bdfb51e6f51eee235c35 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 7 Aug 2024 18:15:57 +0200 Subject: fix: `rename` watch event missing (#24893) This PR ensures that we forward a `rename` event in our file watcher. The rust lib we use combines that with the `modify` event. This fixes a compatibility issue with Node too, which sends the `rename` event as well. Fixes https://github.com/denoland/deno/issues/24880 --- runtime/ops/fs_events.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index 367866162..58fe9d5fd 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -14,6 +14,7 @@ use deno_core::op2; use deno_permissions::PermissionsContainer; use notify::event::Event as NotifyEvent; +use notify::event::ModifyKind; use notify::Error as NotifyError; use notify::EventKind; use notify::RecommendedWatcher; @@ -71,7 +72,13 @@ impl From for FsEvent { EventKind::Any => "any", EventKind::Access(_) => "access", EventKind::Create(_) => "create", - EventKind::Modify(_) => "modify", + EventKind::Modify(modify_kind) => match modify_kind { + ModifyKind::Name(_) => "rename", + ModifyKind::Any + | ModifyKind::Data(_) + | ModifyKind::Metadata(_) + | ModifyKind::Other => "modify", + }, EventKind::Remove(_) => "remove", EventKind::Other => "other", }; -- cgit v1.2.3