refactor(cron): copy os.environ before sanitizing for subprocess

Matches the env= callsite convention at the other sanitized
subprocess spawns (cua_backend dict(os.environ), gateway
os.environ.copy()). Functionally equivalent — _sanitize_subprocess_env
never mutates its input — but avoids handing the live mapping to the
helper.

Follow-up to salvaged PR #49207.
This commit is contained in:
kshitijk4poor 2026-06-20 00:29:46 +05:30
parent 2d978bf44a
commit 8dc0b18894

View file

@ -1035,7 +1035,7 @@ def _run_job_script(script_path: str) -> tuple[bool, str]:
text=True,
timeout=script_timeout,
cwd=str(path.parent),
env=_sanitize_subprocess_env(os.environ),
env=_sanitize_subprocess_env(os.environ.copy()),
**popen_kwargs,
)
stdout = (result.stdout or "").strip()