fix: Resolve AttributeError and clean up ignored watch descriptors

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-17 11:09:38 -07:00
parent a0f3b2668b
commit a92c0464d2

View File

@@ -59,12 +59,19 @@ def main():
if events:
for event in events:
logging.debug(f"Event: {event!r}")
if event.mask & flags.IGNORED:
logging.info(f"Watch for wd {event.wd} was removed (directory deleted?).")
if event.wd in wd_to_path:
logging.info(f"Removing path '{wd_to_path[event.wd]}' from watch mapping.")
del wd_to_path[event.wd]
continue
if event.mask & flags.ISDIR and (event.mask & flags.CREATE or event.mask & flags.MOVED_TO):
parent_dir_path = wd_to_path.get(event.wd)
if not parent_dir_path:
logging.warning(f"Could not find path for watch descriptor {event.wd}")
continue
new_dir_path = os.path.join(parent_dir_path, event.name.decode('utf-8'))
new_dir_path = os.path.join(parent_dir_path, event.name)
logging.info(f"New directory {new_dir_path} detected, adding watches.")
add_watch_recursive(inotify, new_dir_path, watch_flags, wd_to_path)
continue