Reap lxc-stop process to prevent zombification, closes #2

This commit is contained in:
Disassembler 2020-04-13 21:58:22 +02:00
parent 54c12759ee
commit ba9baa9362
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -194,8 +194,10 @@ class Container:
def do_stop(self): def do_stop(self):
# Stop the current container and wait until it stops completely # Stop the current container and wait until it stops completely
subprocess.Popen(['lxc-stop', '-P', config.CONTAINERS_DIR, self.name]) lxc_stop = subprocess.Popen(['lxc-stop', '-P', config.CONTAINERS_DIR, self.name])
self.await_state(ContainerState.STOPPED) self.await_state(ContainerState.STOPPED)
# Reap the lxc-stop process
lxc_stop.wait()
def execute(self, cmd, uid=None, gid=None, **kwargs): def execute(self, cmd, uid=None, gid=None, **kwargs):
# If the container is starting or stopping, wait until the operation is finished # If the container is starting or stopping, wait until the operation is finished