From e7d7eba68f4276b79fc2bd52e563c63c1b9a5e44 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Thu, 11 May 2023 22:55:13 +0200 Subject: [PATCH] Fix the bot starting when using --debuginfo (#6131) --- redbot/__main__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/redbot/__main__.py b/redbot/__main__.py index 90a547cf5..635ef7f15 100644 --- a/redbot/__main__.py +++ b/redbot/__main__.py @@ -268,7 +268,7 @@ def _copy_data(data): def early_exit_runner( cli_flags: Namespace, func: Union[Callable[[], Awaitable[Any]], Callable[[Red, Namespace], Awaitable[Any]]], -) -> None: +) -> NoReturn: """ This one exists to not log all the things like it's a full run of the bot. """ @@ -277,6 +277,7 @@ def early_exit_runner( try: if not cli_flags.instance_name: loop.run_until_complete(func()) + sys.exit(ExitCodes.SHUTDOWN) return data_manager.load_basic_configuration(cli_flags.instance_name) @@ -288,11 +289,13 @@ def early_exit_runner( except (KeyboardInterrupt, EOFError): print("Aborted!") finally: - loop.run_until_complete(asyncio.sleep(1)) + # note: sleep is unnecessary since we're not making any network connections asyncio.set_event_loop(None) loop.stop() loop.close() + sys.exit(ExitCodes.SHUTDOWN) + async def run_bot(red: Red, cli_flags: Namespace) -> None: """