Skip to content

Commit

Permalink
Merge pull request #1430 from zrquan/patch-signal
Browse files Browse the repository at this point in the history
use signal.signal() on Windows
  • Loading branch information
maurosoria authored Nov 1, 2024
2 parents 8f83e14 + 5fc9625 commit f1a1d30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ def run(self) -> None:
self.requester = Requester()
if options["async_mode"]:
self.loop = asyncio.new_event_loop()
self.loop.add_signal_handler(signal.SIGINT, self.handle_pause)
try:
self.loop.add_signal_handler(signal.SIGINT, self.handle_pause)
except NotImplementedError:
# Windows
signal.signal(signal.SIGINT, self.handle_pause)
signal.signal(signal.SIGTERM, self.handle_pause)

while options["urls"]:
url = options["urls"][0]
Expand Down

0 comments on commit f1a1d30

Please sign in to comment.