Skip to content

Commit

Permalink
🐛 Fix: reload exclude 相对路径不生效 (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Apr 4, 2024
1 parent aa7fefa commit 7c00423
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nb_cli/handlers/reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def __init__(
]
self.exclude_dirs = []
for e in excludes:
p = Path(e)
p = Path(e).expanduser()
try:
is_dir = p.is_dir()
except OSError: # pragma: no cover
# gets raised on Windows for values like "*.py"
is_dir = False

if is_dir:
self.exclude_dirs.append(p)
self.exclude_dirs.append(p.resolve())
else:
self.excludes.append(e)
self.excludes = list(set(self.excludes))
Expand Down Expand Up @@ -165,7 +165,7 @@ async def shutdown(self) -> None:
async def should_restart(self) -> Optional[list[Path]]:
changes = await self.watcher.__anext__()
if changes:
unique_paths = {Path(c[1]) for c in changes}
unique_paths = {Path(c[1]).resolve() for c in changes}
return [p for p in unique_paths if self.watch_filter(p)]
return None

Expand Down

0 comments on commit 7c00423

Please sign in to comment.