feat: add encoding param to watch_source_files with error handling

This commit is contained in:
Paul Gauthier (aider) 2024-10-25 13:23:46 -07:00
parent 378c67d51f
commit 54aebb7d98

View file

@ -59,7 +59,7 @@ def load_gitignores(gitignore_paths: list[Path]) -> Optional[PathSpec]:
def watch_source_files( def watch_source_files(
directory: str, stop_event=None, gitignores: list[str] = None, ignore_func=None directory: str, stop_event=None, gitignores: list[str] = None, ignore_func=None, encoding="utf-8"
) -> Set[str]: ) -> Set[str]:
""" """
Watch for changes to source files in the given directory and its subdirectories. Watch for changes to source files in the given directory and its subdirectories.
@ -98,7 +98,7 @@ def watch_source_files(
# Check if file contains AI markers # Check if file contains AI markers
try: try:
with open(path_abs) as f: with open(path_abs, encoding=encoding, errors='ignore') as f:
content = f.read() content = f.read()
import re import re