From ef9fc9d6f441c63f58c7f244e5afeb82b1b4bf22 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 30 Jul 2022 23:39:55 +0800 Subject: remove repeat events for watch --- xmake/plugins/watch/main.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xmake/plugins/watch/main.lua b/xmake/plugins/watch/main.lua index 3293296fa..af96349b8 100644 --- a/xmake/plugins/watch/main.lua +++ b/xmake/plugins/watch/main.lua @@ -134,10 +134,11 @@ function main() status = "deleted" end print(event.path, status) - table.insert(events, event) + -- we use map to remove repeat event + events[event.path .. tostring(event.type)] = event count = count + 1 elseif count > 0 then - _run_command(events) + _run_command(table.values(events)) count = 0 end end -- cgit v1.3.1