From 0425226521140c3a5747577ee66dc69ff16f7e4b Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Thu, 29 Jan 2026 14:54:48 +0100 Subject: [PATCH] win: fix watch loop logic Refs: https://github.com/nodejs/node/issues/61398 --- src/win/fs-event.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/win/fs-event.c b/src/win/fs-event.c index fd77f2a49..f4be52436 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -599,6 +599,23 @@ void uv__process_fs_event_req(uv_loop_t* loop, uv_req_t* req, if (handle->flags & UV_HANDLE_CLOSING) { uv__want_endgame(loop, (uv_handle_t*)handle); } else if (uv__is_active(handle)) { + /* + * Check if the handle has become a zombie pointing to $Extend\$Deleted. + * If so, report as deleted and don't re-queue. + */ + WCHAR path_buf[MAX_PATH]; + DWORD path_len = GetFinalPathNameByHandleW(handle->dir_handle, + path_buf, + MAX_PATH, + FILE_NAME_NORMALIZED); + + if (path_len > 0 && path_len < MAX_PATH) { + if (wcsstr(path_buf, L"$Extend\\$Deleted") != NULL) { + handle->cb(handle, NULL, 0, UV_ENOENT); + return; + } + } + uv__fs_event_queue_readdirchanges(loop, handle); } }