diff --git a/docs/release-notes.md b/docs/release-notes.md index 9e7bc6aae..3e6c2abbe 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,12 @@ toc_depth: 2 --- +## 0.34.2 (April 19, 2025) + +### Fixed + +* Flush stdout buffer on Windows to trigger reload (#2604) + ## 0.34.1 (April 13, 2025) ### Deprecated diff --git a/uvicorn/__init__.py b/uvicorn/__init__.py index 32e98cd44..0e8f4b2be 100644 --- a/uvicorn/__init__.py +++ b/uvicorn/__init__.py @@ -1,5 +1,5 @@ from uvicorn.config import Config from uvicorn.main import Server, main, run -__version__ = "0.34.1" +__version__ = "0.34.2" __all__ = ["main", "run", "Config", "Server"] diff --git a/uvicorn/supervisors/basereload.py b/uvicorn/supervisors/basereload.py index 4df50af33..eed999230 100644 --- a/uvicorn/supervisors/basereload.py +++ b/uvicorn/supervisors/basereload.py @@ -90,6 +90,10 @@ def restart(self) -> None: self.is_restarting = True assert self.process.pid is not None os.kill(self.process.pid, signal.CTRL_C_EVENT) + + # This is a workaround to ensure the Ctrl+C event is processed + sys.stdout.write(" ") # This has to be a non-empty string + sys.stdout.flush() else: # pragma: py-win32 self.process.terminate() self.process.join()