eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 165557070e1bfc032acac6ad0fc0e48408e9de41
parent 920dc5b087bc7b0de8cbdb678a56339de970ff7c
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue,  7 Sep 2021 09:54:36 -0700

test-runner: fix process cleanup

Processes which were not explicitly killed ended up staying around
forever because they internally held references to other objects
such as GLib IO watches or write FDs.

This shuffles some code so these objects get cleaned up both when
explititly killed and after being waited for.

Diffstat:
Mtools/test-runner | 31+++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/test-runner b/tools/test-runner @@ -287,7 +287,23 @@ class Process(subprocess.Popen): # Override wait() so it can do so non-blocking def wait(self, timeout=10): Namespace.non_block_wait(self.__wait, timeout, 1) + self._cleanup() + def _cleanup(self): + if self.cleanup: + self.cleanup() + + self.write_fds = [] + + if self.io_watch: + GLib.source_remove(self.io_watch) + self.io_watch = None + + self.cleanup = None + self.killed = True + + if self in self.ctx.processes: + self.ctx.processes.remove(self) # Override kill() def kill(self, force=False): if self.killed: @@ -306,20 +322,7 @@ class Process(subprocess.Popen): dbg("Process %s did not complete in 15 seconds!" % self.name) super().kill() - if self.cleanup: - self.cleanup() - - self.write_fds = [] - - if self.io_watch: - GLib.source_remove(self.io_watch) - self.io_watch = None - - self.cleanup = None - self.killed = True - - if self in self.ctx.processes: - self.ctx.processes.remove(self) + self._cleanup() def __str__(self): return str(self.args) + '\n'