Skip to content

Commit

Permalink
Suppress KeyboardInterrupt from CLI and programmatic usage (#2384)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcelo Trylesinski <[email protected]>
  • Loading branch information
maxfischer2781 and Kludex authored Jul 20, 2024
1 parent ca24e1b commit 875f6c6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions uvicorn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ def run(
Multiprocess(config, target=server.run, sockets=[sock]).run()
else:
server.run()
except KeyboardInterrupt:
pass
finally:
if config.uds and os.path.exists(config.uds):
os.remove(config.uds) # pragma: py-win32
Expand Down

0 comments on commit 875f6c6

Please sign in to comment.