Only do loop cleanup in finally block when on windows.
Should also fix #545.
This commit is contained in:
parent
1e1b02c630
commit
4dfaffd5f2
@ -498,7 +498,8 @@ class Client:
|
|||||||
is blocking. That means that registration of events or anything being
|
is blocking. That means that registration of events or anything being
|
||||||
called after this function call will not execute until it returns.
|
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.SIGINT, self._do_cleanup)
|
||||||
self.loop.add_signal_handler(signal.SIGTERM, self._do_cleanup)
|
self.loop.add_signal_handler(signal.SIGTERM, self._do_cleanup)
|
||||||
|
|
||||||
@ -507,6 +508,7 @@ class Client:
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
if is_windows:
|
||||||
self._do_cleanup()
|
self._do_cleanup()
|
||||||
|
|
||||||
# properties
|
# properties
|
||||||
|
Loading…
x
Reference in New Issue
Block a user