fix: handle gateway Ctrl+C shutdown cleanly

This commit is contained in:
Rylen Anil
2026-04-30 09:04:48 +00:00
committed by Teknium
parent 01d7c87ecc
commit 3858f9419e
2 changed files with 53 additions and 2 deletions

View File

@@ -2368,7 +2368,11 @@ def run_gateway(verbose: int = 0, quiet: bool = False, replace: bool = False):
# Exit with code 1 if gateway fails to connect any platform,
# so systemd Restart=on-failure will retry on transient errors
verbosity = None if quiet else verbose
success = asyncio.run(start_gateway(replace=replace, verbosity=verbosity))
try:
success = asyncio.run(start_gateway(replace=replace, verbosity=verbosity))
except KeyboardInterrupt:
print("\nGateway stopped.")
return
if not success:
sys.exit(1)