mirror of
https://github.com/borgbase/vorta
synced 2025-01-03 05:36:19 +00:00
terminate process
This commit is contained in:
parent
d721011c90
commit
c8ccd16dad
1 changed files with 11 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue