diff options
| author | user <user@clank> | 2026-08-13 19:49:51 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-13 19:49:51 +0200 |
| commit | 763adf673eef449686d03692b611c473e07e6d47 (patch) | |
| tree | 2c1dc62cd679952db8c0626c631564ed3576dd2c | |
| parent | sl0p: make the split button work on stacked panes too (diff) | |
| download | sl0ppi-763adf673eef449686d03692b611c473e07e6d47.tar.gz sl0ppi-763adf673eef449686d03692b611c473e07e6d47.tar.xz sl0ppi-763adf673eef449686d03692b611c473e07e6d47.zip | |
check: stop the live check leaking a server per run
kill-session does not always take the server with it: 38 of them had piled up
on this box, one per run, and a leftover test session is exactly what produced
a "MY FOCUS" bug report from the user once already.
Matched on `comm` plus the run's own socket dir, never `pkill -f` -- that
matches the checking process's own command line, and has killed real clients
here before. The temp dir goes with it.
| -rwxr-xr-x | packaging/checks/split-button-live.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packaging/checks/split-button-live.py b/packaging/checks/split-button-live.py index dd8862d..cb732e1 100755 --- a/packaging/checks/split-button-live.py +++ b/packaging/checks/split-button-live.py @@ -24,6 +24,7 @@ import fcntl import os import pty import re +import shutil import struct import subprocess import sys @@ -422,6 +423,28 @@ def main(): subprocess.run( [BIN, "-s", SESSION, "kill-session"], env=env, capture_output=True, text=True ) + # kill-session does not always take the server with it, and a leftover + # test session is how a "MY FOCUS" bug report gets filed against nobody. + # + # Matched on `comm` plus THIS run's socket dir, never `pkill -f`: that + # matches the checking process's own command line, and has killed real + # clients here before. + time.sleep(1) + ps = subprocess.run( + ["ps", "-eo", "pid,comm,args"], capture_output=True, text=True + ).stdout + for line in ps.splitlines(): + fields = line.split(None, 2) + if len(fields) < 3: + continue + pid_str, comm, args = fields + if comm == os.path.basename(BIN) and tmp in args: + try: + os.kill(int(pid_str), 15) + print(f"cleaned up leftover server {pid_str}") + except (ProcessLookupError, ValueError, PermissionError): + pass + shutil.rmtree(tmp, ignore_errors=True) for p, f in ((pid, fd), (second_pid, second_fd)): if f is None: continue |
