From f3580def030ef30103db1e40e848c7b8799f96a8 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Fri, 4 May 2018 00:21:43 +0300 Subject: [PATCH] Return result from executor. (`Executor.start(...)`) --- aiogram/utils/executor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aiogram/utils/executor.py b/aiogram/utils/executor.py index 9fa7121c..a3b19844 100644 --- a/aiogram/utils/executor.py +++ b/aiogram/utils/executor.py @@ -75,7 +75,7 @@ def start(dispatcher, func, *, loop=None, skip_updates=None, executor = Executor(dispatcher, skip_updates=skip_updates, loop=loop) _setup_callbacks(executor, on_startup, on_shutdown) - executor.start(func) + return executor.start(func) class Executor: @@ -250,12 +250,14 @@ class Executor: try: loop.run_until_complete(self._startup_polling()) - loop.run_until_complete(func) + result = loop.run_until_complete(func) except (KeyboardInterrupt, SystemExit): + result = None loop.stop() finally: loop.run_until_complete(self._shutdown_polling()) log.warning("Goodbye!") + return result async def _skip_updates(self): await self.dispatcher.reset_webhook(True)