From ba9baa93623133b4f22d0dd959d9d1dd74dcfc5b Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 13 Apr 2020 21:58:22 +0200 Subject: [PATCH] Reap lxc-stop process to prevent zombification, closes #2 --- usr/lib/python3.8/spoc/container.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr/lib/python3.8/spoc/container.py b/usr/lib/python3.8/spoc/container.py index d45e831..d0dd482 100644 --- a/usr/lib/python3.8/spoc/container.py +++ b/usr/lib/python3.8/spoc/container.py @@ -194,8 +194,10 @@ class Container: def do_stop(self): # 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) + # Reap the lxc-stop process + lxc_stop.wait() def execute(self, cmd, uid=None, gid=None, **kwargs): # If the container is starting or stopping, wait until the operation is finished