Skip to content

Commit

Permalink
discord: client: Ignore RuntimeError when calling add_signal_handler() (
Browse files Browse the repository at this point in the history
#673)

* When Client.run() is called in a new thread (using threading.Thread), add_signal_handler will raise the following exception:
* RuntimeError: set_wakeup_fd only works in main thread of the main interpreter
* We can ignore this as well

Change-Id: Id21beaff59e1450186c4410e1ead41c0f738e01e
Signed-off-by: Sebastiano Barezzi <[email protected]>
  • Loading branch information
SebaUbuntu authored Jan 7, 2022
1 parent 2377a74 commit 6084448
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def run(self, *args: Any, **kwargs: Any) -> None:
try:
loop.add_signal_handler(signal.SIGINT, lambda: loop.stop())
loop.add_signal_handler(signal.SIGTERM, lambda: loop.stop())
except NotImplementedError:
except (NotImplementedError, RuntimeError):
pass

async def runner():
Expand Down

0 comments on commit 6084448

Please sign in to comment.