Skip to content

Commit

Permalink
use signal.signal() on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zrquan committed Nov 1, 2024
1 parent 8f83e14 commit 5fc9625
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 5fc9625

Please sign in to comment.