diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-10-28 09:00:41 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-10-28 09:00:41 +0100 |
| commit | 77706bcb80c889cb72c1be11c1cd7d32d284039c (patch) | |
| tree | 6d39db092b266a3a95ba4107f201032bf86ee318 | |
| parent | 2a955d6bb5b3cee3f17c77f32a997e4710e97e27 (diff) | |
| download | vis-inotify-main.tar.gz vis-inotify-main.zip | |
| -rw-r--r-- | init.lua | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -22,6 +22,9 @@ if not os.execute('type inotifywait >/dev/null 2>/dev/null') then return {} end +-- vis is exiting to not recreate watches +local exiting = false + -- We have to keep the handles to our communicate processes otherwise -- vis will terminate them. local watches = {} -- luacheck: ignore watches @@ -41,7 +44,7 @@ local function _add_watch(file, func, mode, cmd_options) if event == 'EXIT' or event == 'SIGNAL' then if event == 'EXIT' then - if mode == 'recreate' then + if mode == 'recreate' and not exiting then -- recreate the watch watches[file] = nil watches[file] = vis:communicate(file, cmd) @@ -72,6 +75,7 @@ M.add_recreate_watch = function(file, func, cmd_options) end vis.events.subscribe(vis.events.QUIT, function() + exiting = true -- Terminate all watches for k, _ in pairs(watches) do watches[k] = nil end end) |
