aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-03-24 20:25:38 -0400
committerRapptz <[email protected]>2017-03-24 20:27:30 -0400
commit9885a946e1b801c383c9ff9d1ac5a5774520d09c (patch)
tree94fbd71486722288578adf0d1f7f30621a9ee1bb /discord/ext
parentSort Guild.text_channels and Guild.voice_channels in UI order. (diff)
downloaddiscord.py-9885a946e1b801c383c9ff9d1ac5a5774520d09c.tar.xz
discord.py-9885a946e1b801c383c9ff9d1ac5a5774520d09c.zip
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.
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/core.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 04149b2a..03da8804 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -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: