Add the exit interrupt and the exit message.

This commit is contained in:
2023-12-12 20:36:14 +02:00
parent ce9c7bb301
commit 5cf868659e
+10 -2
View File
@@ -18,6 +18,9 @@
###############################################################################
import asyncio
import sys
from rich.console import Console
import typer
from notification_server.server import Server
@@ -44,5 +47,10 @@ def up(
This command [b]start[/] the [yellow b]server[/] which receives notifications and sends to the clients.
"""
server = Server(ip, port, producer_port)
asyncio.run(server.up())
try:
server = Server(ip, port, producer_port)
asyncio.run(server.up())
except KeyboardInterrupt:
console = Console()
console.print('[green b][INFO][/] bye[/]')
sys.exit(0)