Do not register signals in non posix OS
This commit is contained in:
parent
92a6101bbe
commit
bac1a51a4a
1 changed files with 7 additions and 5 deletions
|
|
@ -280,12 +280,14 @@ class Download:
|
||||||
|
|
||||||
self.started_time = int(time.time())
|
self.started_time = int(time.time())
|
||||||
|
|
||||||
def mark_cancelled(*_):
|
if "posix" == os.name:
|
||||||
cls._interrupted = True
|
|
||||||
cls.to_screen("[info] Interrupt received, exiting cleanly...")
|
|
||||||
raise SystemExit(130) # noqa: TRY301
|
|
||||||
|
|
||||||
signal.signal(signal.SIGUSR1, mark_cancelled)
|
def mark_cancelled(*_) -> None:
|
||||||
|
cls._interrupted = True
|
||||||
|
cls.to_screen("[info] Interrupt received, exiting cleanly...")
|
||||||
|
raise SystemExit(130) # noqa: TRY301
|
||||||
|
|
||||||
|
signal.signal(signal.SIGUSR1, mark_cancelled)
|
||||||
|
|
||||||
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
||||||
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
|
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue