Update the handler to close the connection if empty data.

main
KKlochko 1 year ago
parent 19b2a231b3
commit 03f633e5ab

@ -58,10 +58,16 @@ class ProducerClient:
message = input('message: ') message = input('message: ')
await self.send_notification(title, message) await self.send_notification(title, message)
if title == '' and message == '':
self.console.print(f"[yellow b][INFO][/] Finished.")
self.console.print("[green]bye[/]")
break
except asyncio.CancelledError: except asyncio.CancelledError:
pass pass
except KeyboardInterrupt: except KeyboardInterrupt:
print("\nbye") print("\nbye")
await self.send_notification('', '')
sys.exit(0) sys.exit(0)
finally: finally:
self.writer.close() self.writer.close()

Loading…
Cancel
Save