Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
Don't fail when signals are not implemented.
Browse files Browse the repository at this point in the history
Prevent Maga from failing during initialization on Windows, as signals are not implemented on that platform.
  • Loading branch information
drxzcl committed Jun 14, 2016
1 parent 9462486 commit 9a8fd4e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion maga.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def run(self, port=6881):
transport, _ = self.loop.run_until_complete(coro)

for signame in ('SIGINT', 'SIGTERM'):
self.loop.add_signal_handler(getattr(signal, signame), self.stop)
try:
self.loop.add_signal_handler(getattr(signal, signame), self.stop)
except NotImplementedError:
# SIGINT and SIGTERM are not implemented on windows
pass

for node in self.bootstrap_nodes:
# Bootstrap
Expand Down

0 comments on commit 9a8fd4e

Please sign in to comment.