From a8032109034dbe40eb2763629c72551b9d32efe6 Mon Sep 17 00:00:00 2001 From: Batkhuu Byambajav Date: Thu, 21 Sep 2023 22:50:01 +0900 Subject: [PATCH] :bug: Fixed --reload-dir option not working as expected. --- uvicorn/supervisors/watchfilesreload.py | 2 +- uvicorn/supervisors/watchgodreload.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uvicorn/supervisors/watchfilesreload.py b/uvicorn/supervisors/watchfilesreload.py index 186368312..1c11169dc 100644 --- a/uvicorn/supervisors/watchfilesreload.py +++ b/uvicorn/supervisors/watchfilesreload.py @@ -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) diff --git a/uvicorn/supervisors/watchgodreload.py b/uvicorn/supervisors/watchgodreload.py index d8bceacef..648a5b9c8 100644 --- a/uvicorn/supervisors/watchgodreload.py +++ b/uvicorn/supervisors/watchgodreload.py @@ -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))