mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-17 03:51:05 +03:00
Fix sync run_until_disconnected not liking Ctrl+C
This commit is contained in:
parent
f6bfcad49e
commit
6152e33454
|
@ -32,11 +32,12 @@ class UpdateMethods(UserMethods):
|
||||||
If the loop is already running, this method returns a coroutine
|
If the loop is already running, this method returns a coroutine
|
||||||
that you should await on your own code.
|
that you should await on your own code.
|
||||||
"""
|
"""
|
||||||
coro = self._run_until_disconnected()
|
if self.loop.is_running():
|
||||||
return (
|
return self._run_until_disconnected()
|
||||||
coro if self.loop.is_running()
|
try:
|
||||||
else self.loop.run_until_complete(coro)
|
return self.loop.run_until_complete(self.disconnected)
|
||||||
)
|
except KeyboardInterrupt:
|
||||||
|
self.loop.run_until_complete(self.disconnect())
|
||||||
|
|
||||||
def on(self, event):
|
def on(self, event):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user