1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 05:36:19 +00:00

terminate process

This commit is contained in:
hasrat17 2024-03-24 15:26:48 +05:30
parent d721011c90
commit c8ccd16dad

View file

@ -113,14 +113,17 @@ def repo_id(self):
return self.site_id
def cancel(self):
logger.debug("Cancel job on site %s", self.site_id)
logger.debug("Cancelling job on site %s", self.site_id)
if self.process is not None:
self.process.send_signal(signal.SIGINT)
self.terminate_process(self.process)
def terminate_process(self, process):
process.send_signal(signal.SIGINT)
try:
self.process.wait(timeout=3)
process.wait(timeout=3)
except TimeoutExpired:
try:
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
except ProcessLookupError:
pass