before_server_stop and after_server_stop do not run on Windows
Tronic opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
On Linux Sanic runs all four server events as expected, but on Windows the server stop events don't get run on Ctrl-C or autoreload.
Code snippet
from sanic import Sanic
app = Sanic(__name__)
@app.before_server_start
async def bstart(app, _):
print("before start")
@app.after_server_start
async def astart(app, _):
print("after start")
@app.before_server_stop
async def bstop(app, _):
print("before stop")
@app.after_server_stop
async def astop(app, _):
print("after stop")
@app.get("/")
async def index(request):
...
Expected Behavior
before start
after start
before stop
after stop
Only the first two print on Windows.
How do you run Sanic?
Sanic CLI
Operating System
Windows
Sanic Version
23.3.0
Additional context
No response