More robust cleanup for Client.run.
This should prevent asyncio.CancelledError from being propagated more and suppressed "Task was destroyed but was pending!" warnings when doing graceful closes outside of using a KeyboardInterrupt. To make clean up a bit more robust, also add signal handlers for POSIX systems.
This commit is contained in:
@ -47,6 +47,8 @@ def wrap_callback(coro):
|
||||
ret = yield from coro(*args, **kwargs)
|
||||
except CommandError:
|
||||
raise
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
except Exception as e:
|
||||
raise CommandInvokeError(e) from e
|
||||
return ret
|
||||
@ -60,6 +62,8 @@ def hooked_wrapped_callback(command, ctx, coro):
|
||||
ret = yield from coro(*args, **kwargs)
|
||||
except CommandError:
|
||||
raise
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
except Exception as e:
|
||||
raise CommandInvokeError(e) from e
|
||||
finally:
|
||||
|
Reference in New Issue
Block a user