From 776795ab5a355d74afb27fd5a8f90810ccc61079 Mon Sep 17 00:00:00 2001 From: Daniel Milchev Date: Wed, 31 Aug 2022 12:26:14 +0300 Subject: [PATCH] [#98]Ensure graceful exit of the quickstart Python script and the How-to guide Python scripts Fixed hono_commands.py Signed-off-by: Daniel Milchev --- quickstart/hono_commands.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickstart/hono_commands.py b/quickstart/hono_commands.py index db6e78c7..6cace573 100644 --- a/quickstart/hono_commands.py +++ b/quickstart/hono_commands.py @@ -56,6 +56,11 @@ def on_message(self, event): print('[ok]', command) else: print('[error]') + event.receiver.close() + event.connection.close() + + def on_connection_closed(self, event): + print('[closing]') os.kill(os.getpid(), signal.SIGINT)