mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Improve consistency of shutdown message across Python versions (#6095)
This commit is contained in:
parent
c6551f4bcc
commit
d8d4b4f15a
@ -420,7 +420,7 @@ def handle_early_exit_flags(cli_flags: Namespace):
|
|||||||
|
|
||||||
async def shutdown_handler(red, signal_type=None, exit_code=None):
|
async def shutdown_handler(red, signal_type=None, exit_code=None):
|
||||||
if signal_type:
|
if signal_type:
|
||||||
log.info("%s received. Quitting...", signal_type)
|
log.info("%s received. Quitting...", signal_type.name)
|
||||||
# Do not collapse the below line into other logic
|
# Do not collapse the below line into other logic
|
||||||
# We need to renter this function
|
# We need to renter this function
|
||||||
# after it interrupts the event loop.
|
# after it interrupts the event loop.
|
||||||
@ -525,7 +525,7 @@ def main():
|
|||||||
# We also have to catch this one here. Basically any exception which normally
|
# We also have to catch this one here. Basically any exception which normally
|
||||||
# Kills the python interpreter (Base Exceptions minus asyncio.cancelled)
|
# Kills the python interpreter (Base Exceptions minus asyncio.cancelled)
|
||||||
# We need to do something with prior to having the loop close
|
# We need to do something with prior to having the loop close
|
||||||
log.info("Shutting down with exit code: %s", exc.code)
|
log.info("Shutting down with exit code: %s (%s)", exc.code.value, exc.code.name)
|
||||||
if red is not None:
|
if red is not None:
|
||||||
loop.run_until_complete(shutdown_handler(red, None, exc.code))
|
loop.run_until_complete(shutdown_handler(red, None, exc.code))
|
||||||
except Exception as exc: # Non standard case.
|
except Exception as exc: # Non standard case.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user