fix(memory): reattach Linux watchers on directory rename

(cherry picked from commit 0db7781514cc84fac4f3a999d24b4b747fc871f9)
This commit is contained in:
Peter Steinberger
2026-06-01 23:14:01 +01:00
parent bd4a7f4119
commit 65d7fa2420

View File

@@ -777,7 +777,7 @@ export abstract class MemoryManagerSyncOps {
watcher = resolveMemoryNativeWatchFactory()(
watchDir,
{ recursive: false },
(_eventType, filename) => {
(eventType, filename) => {
if (filename == null) {
markDirty();
if (!this.attachLinuxMemoryDirectoryTreeSubtree(watchDir, attachDirectory)) {
@@ -799,6 +799,9 @@ export abstract class MemoryManagerSyncOps {
closeDirectorySubtree(full);
}
if (stats?.isDirectory()) {
if (eventType === "rename") {
closeDirectorySubtree(full);
}
if (!this.attachLinuxMemoryDirectoryTreeSubtree(full, attachDirectory)) {
closeAndFallback(
`failed to attach Linux memory directory watcher under ${full}; falling back to chokidar`,