Skip to content

Commit

Permalink
🐛 Fixed --reload-dir option not working as expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
bybatkhuu committed Sep 21, 2023
1 parent 8e68642 commit a803210
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion uvicorn/supervisors/watchfilesreload.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
for directory in config.reload_dirs:
if Path.cwd() not in directory.parents:
self.reload_dirs.append(directory)
if Path.cwd() not in self.reload_dirs:
if (len(self.reload_dirs) == 0) and (Path.cwd() not in self.reload_dirs):
self.reload_dirs.append(Path.cwd())

self.watch_filter = FileFilter(config)
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/supervisors/watchgodreload.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def __init__(
for directory in config.reload_dirs:
if Path.cwd() not in directory.parents:
reload_dirs.append(directory)
if Path.cwd() not in reload_dirs:
if (len(reload_dirs) == 0) and (Path.cwd() not in reload_dirs):
reload_dirs.append(Path.cwd())
for w in reload_dirs:
self.watchers.append(CustomWatcher(w.resolve(), self.config))
Expand Down

0 comments on commit a803210

Please sign in to comment.