diff options
| author | Rapptz <[email protected]> | 2017-05-20 12:06:58 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-20 12:08:02 -0400 |
| commit | 4dfaffd5f23d184c05b32f1a6a4b69aabaf74124 (patch) | |
| tree | 2e77685fd01a9dde7c2c78303be40fd1102ee3ac | |
| parent | Check if we're closing the event loop before using it. (diff) | |
| download | discord.py-4dfaffd5f23d184c05b32f1a6a4b69aabaf74124.tar.xz discord.py-4dfaffd5f23d184c05b32f1a6a4b69aabaf74124.zip | |
Only do loop cleanup in finally block when on windows.
Should also fix #545.
| -rw-r--r-- | discord/client.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/discord/client.py b/discord/client.py index ea216dd1..85d03056 100644 --- a/discord/client.py +++ b/discord/client.py @@ -498,7 +498,8 @@ class Client: is blocking. That means that registration of events or anything being called after this function call will not execute until it returns. """ - if sys.platform != 'win32': + is_windows = sys.platform == 'win32' + if not is_windows: self.loop.add_signal_handler(signal.SIGINT, self._do_cleanup) self.loop.add_signal_handler(signal.SIGTERM, self._do_cleanup) @@ -507,7 +508,8 @@ class Client: except KeyboardInterrupt: pass finally: - self._do_cleanup() + if is_windows: + self._do_cleanup() # properties |