From 3dc2decd43b077cf1676756a439a33aceaa3906b Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 26 Jul 2026 13:21:32 -0700 Subject: [PATCH] fix(update): explicit utf-8 decoding on systemctl restart calls Windows-footguns lint: subprocess text=True without encoding= decodes via locale.getpreferredencoding(). Match the file's house style. --- hermes_cli/main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 3b3c13b033bd..a5d175102efc 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -7124,7 +7124,12 @@ def _try_restart_systemd_service(svc_name: str, cgroup_path: str | None = None) ["systemctl", "--user", "restart", svc_name], ): try: - r = subprocess.run(candidate, capture_output=True, text=True, timeout=15) + r = subprocess.run( + candidate, + capture_output=True, + text=True, encoding="utf-8", errors="replace", + timeout=15, + ) if r.returncode == 0: return True except (FileNotFoundError, subprocess.TimeoutExpired, OSError): @@ -7132,7 +7137,12 @@ def _try_restart_systemd_service(svc_name: str, cgroup_path: str | None = None) return False try: - r = subprocess.run(cmd, capture_output=True, text=True, timeout=15) + r = subprocess.run( + cmd, + capture_output=True, + text=True, encoding="utf-8", errors="replace", + timeout=15, + ) return r.returncode == 0 except (FileNotFoundError, subprocess.TimeoutExpired, OSError): return False