mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-23 21:17:50 +00:00
connection: kill spawned child subprocesses:
Subprocesses that were spawned under the same pgid were not necessarily being terminated when the parent was terminated, allowing them to continue running. This change explicitly kills the process group involved.
This commit is contained in:
parent
0498017bf0
commit
dc7faf46e4
@ -203,11 +203,11 @@ class PopenBackgroundCommand(BackgroundCommand):
|
|||||||
|
|
||||||
def cancel(self, kill_timeout=_KILL_TIMEOUT):
|
def cancel(self, kill_timeout=_KILL_TIMEOUT):
|
||||||
popen = self.popen
|
popen = self.popen
|
||||||
popen.send_signal(signal.SIGTERM)
|
os.killpg(os.getpgid(popen.pid), signal.SIGTERM)
|
||||||
try:
|
try:
|
||||||
popen.wait(timeout=_KILL_TIMEOUT)
|
popen.wait(timeout=_KILL_TIMEOUT)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
popen.kill()
|
os.killpg(os.getpgid(popen.pid), signal.SIGKILL)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.popen.__exit__(None, None, None)
|
self.popen.__exit__(None, None, None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user