Skip to content

Commit 4949b24

Browse files
committed
fix infinite loop on watch trigger
1 parent ab31bfb commit 4949b24

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

entangled/commands/watch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
from threading import Event
2+
from pathlib import Path
23

34
from ..status import find_watch_dirs
5+
from ..logging import logger
46

57
from .sync import run_sync
68
from .main import main
79

810
import watchfiles
911

1012

13+
log = logger()
14+
15+
1116
def watch_filter(change: watchfiles.Change, path: str) -> bool:
12-
if path.startswith(".entangled"):
17+
if Path(path).relative_to(Path.cwd()).as_posix().startswith(".entangled"):
1318
return False
1419
return True
1520

@@ -30,6 +35,7 @@ def stop() -> bool:
3035
dirs = "." # find_watch_dirs()
3136

3237
for changes in watchfiles.watch(dirs, stop_event=_stop_event, watch_filter=watch_filter):
38+
log.debug(changes)
3339
run_sync()
3440

3541

0 commit comments

Comments
 (0)