catch CancelledError in lifespan hack for windows (#4083)

This commit is contained in:
Thomas Brandého 2024-10-07 09:27:36 -07:00 committed by GitHub
parent 12b81ad754
commit 1f3be6340c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,10 +19,13 @@ async def windows_hot_reload_lifespan_hack():
import asyncio
import sys
while True:
sys.stderr.write("\0")
sys.stderr.flush()
await asyncio.sleep(0.5)
try:
while True:
sys.stderr.write("\0")
sys.stderr.flush()
await asyncio.sleep(0.5)
except asyncio.CancelledError:
pass
@contextlib.contextmanager