From d19120844e4369e114198984ce25c2b447a3fb4b Mon Sep 17 00:00:00 2001 From: abraunegg Date: Fri, 13 Dec 2024 06:31:43 +1100 Subject: [PATCH] Update monitor.d * Pull in suggested fix from #2586 --- src/monitor.d | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/monitor.d b/src/monitor.d index 349562c7f..cd19d84a7 100644 --- a/src/monitor.d +++ b/src/monitor.d @@ -610,6 +610,12 @@ final class Monitor { } else if (event.mask & IN_CREATE) { if (debugLogging) {addLogEntry("event IN_CREATE: " ~ path, ["debug"]);} if (event.mask & IN_ISDIR) { + // fix from #2586 + foreach (cookie, path1; cookieToPath1) { + if (path1 == path) { + cookieToPath.remove(cookie); + } + } addRecursive(path); if (useCallbacks) actionHolder.append(ActionType.createDir, path); } @@ -622,6 +628,13 @@ final class Monitor { } } else if ((event.mask & IN_CLOSE_WRITE) && !(event.mask & IN_ISDIR)) { if (debugLogging) {addLogEntry("event IN_CLOSE_WRITE and not IN_ISDIR: " ~ path, ["debug"]);} + // fix from #2586 + auto cookieToPath1 = cookieToPath.dup(); + foreach (cookie, path1; cookieToPath1) { + if (path1 == path) { + cookieToPath.remove(cookie); + } + } if (useCallbacks) actionHolder.append(ActionType.changed, path); } else { addLogEntry("inotify event unhandled: " ~ path);