From c11bc69a665c92da173968e3acab1b4fb3ee5cb9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 13 Aug 2023 23:55:40 +0200 Subject: [PATCH] Handle `KeyboardInterrupt` and process return code in the main. --- platypush/app.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platypush/app.py b/platypush/app.py index 9d218ab9..d262b615 100644 --- a/platypush/app.py +++ b/platypush/app.py @@ -321,7 +321,18 @@ def main(*args: str): Application entry point. """ app = Application.from_cmdline(args) - app.run() + + try: + app.run() + except KeyboardInterrupt: + pass + + log.info('Application stopped') + return 0 + + +if __name__ == '__main__': + sys.exit(main(*sys.argv[1:])) # vim:sw=4:ts=4:et: