diff --git a/linkcheck/director/__init__.py b/linkcheck/director/__init__.py index 7fce5fb3..f7e837b3 100644 --- a/linkcheck/director/__init__.py +++ b/linkcheck/director/__init__.py @@ -62,6 +62,9 @@ def check_url (aggregate): aggregate.remove_stopped_threads() if not aggregate.threads: break + if aggregate.wanted_stop: + # some other thread wants us to stop + raise KeyboardInterrupt def interrupt (aggregate): diff --git a/linkcheck/director/aggregator.py b/linkcheck/director/aggregator.py index 2383f321..af416451 100644 --- a/linkcheck/director/aggregator.py +++ b/linkcheck/director/aggregator.py @@ -39,6 +39,7 @@ class Aggregate (object): self.logger = logger.Logger(config) self.threads = [] self.last_w3_call = 0 + self.wanted_stop = False def start_threads (self): """Spawn threads for URL checking and status printing."""