From 0f732cb3d6b11dc903ca4303ef2cabd99cbe0adc Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Fri, 24 Jul 2026 11:21:14 -0700 Subject: [PATCH] fix(cron): respect the platform-conditional decode design in _run_job_script + taskkill kwarg snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cron/scheduler.py deliberately applies utf-8/replace only on Windows via popen_kwargs (non-Windows keeps locale default per its test contract) — drop the sweep's unconditional inline kwargs there. Update the gateway force-kill kwarg snapshot for the new guard. --- cron/scheduler.py | 2 +- tests/test_windows_subprocess_no_window_flags.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cron/scheduler.py b/cron/scheduler.py index 40937cf59714..c309c59c4e5a 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -2301,7 +2301,7 @@ def _run_job_script(script_path: str) -> tuple[bool, str]: result = subprocess.run( argv, capture_output=True, - text=True, encoding='utf-8', errors='replace', + text=True, timeout=script_timeout, cwd=str(path.parent), env=env, diff --git a/tests/test_windows_subprocess_no_window_flags.py b/tests/test_windows_subprocess_no_window_flags.py index 8ae181f654b6..0dcf29405ba4 100644 --- a/tests/test_windows_subprocess_no_window_flags.py +++ b/tests/test_windows_subprocess_no_window_flags.py @@ -508,6 +508,8 @@ def test_gateway_force_kill_hides_taskkill_window(monkeypatch): { "capture_output": True, "text": True, + "encoding": "utf-8", + "errors": "replace", "timeout": 10, "creationflags": _CREATE_NO_WINDOW, },