From 16ce073d0c1bba75edd35d9e361197dabc52afa8 Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Sun, 17 May 2026 01:28:55 -0700 Subject: [PATCH] fix(cli): keep child cleanup working on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _cleanup_children() called os.killpg unconditionally — Windows doesn't have killpg as an attribute on os, so the call raised AttributeError (not caught by the existing OSError-family handler) and aborted cleanup. Guard with hasattr(os, "killpg") and fall back to os.kill(pid, SIGTERM) on platforms without process-group APIs. Closes #226. Refs #110. Co-authored-by: gujishh --- skills/last30days/scripts/last30days.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skills/last30days/scripts/last30days.py b/skills/last30days/scripts/last30days.py index c7daba6..2699652 100644 --- a/skills/last30days/scripts/last30days.py +++ b/skills/last30days/scripts/last30days.py @@ -63,7 +63,10 @@ def _cleanup_children() -> None: pids = list(_child_pids) for pid in pids: try: - os.killpg(os.getpgid(pid), signal.SIGTERM) + if hasattr(os, "killpg"): + os.killpg(os.getpgid(pid), signal.SIGTERM) + else: + os.kill(pid, signal.SIGTERM) except (ProcessLookupError, PermissionError, OSError): continue