Skip to content

Commit

Permalink
allow suppressing KI
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfischer2781 committed Jul 5, 2024
1 parent 3cfe324 commit 3104b75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uvicorn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def run(
app_dir: str | None = None,
factory: bool = False,
h11_max_incomplete_event_size: int | None = None,
suppress_ki: bool = False,
) -> None:
if app_dir is not None:
sys.path.insert(0, app_dir)
Expand Down Expand Up @@ -577,7 +578,9 @@ def run(
server.run()
except KeyboardInterrupt:
# KI is received deep inside asyncio and comes with a noisy traceback
# raise a new KI here to shorten the traceback
# suppress it or raise a new KI here to shorten the traceback
if suppress_ki:
return
raise KeyboardInterrupt("quit uvicorn") from None
finally:
if config.uds and os.path.exists(config.uds):
Expand Down

0 comments on commit 3104b75

Please sign in to comment.