fix(windows): hide cron script subprocess consoles

Apply CREATE_NO_WINDOW flags when the cron scheduler launches job scripts on Windows so gateway-managed no-agent cron jobs do not flash cmd or python console windows every tick.
This commit is contained in:
nekwo 2026-05-16 13:38:38 -04:00 committed by Teknium
parent 2a7308b7c4
commit f007ef8ab5

View file

@ -37,6 +37,7 @@ from typing import List, Optional
sys.path.insert(0, str(Path(__file__).parent.parent))
from hermes_constants import get_hermes_home
from hermes_cli._subprocess_compat import windows_hide_flags
from hermes_cli.config import load_config, _expand_env_vars
from hermes_time import now as _hermes_now
@ -887,6 +888,7 @@ def _run_job_script(script_path: str) -> tuple[bool, str]:
pass
try:
popen_kwargs = {"creationflags": windows_hide_flags()} if sys.platform == "win32" else {}
result = subprocess.run(
argv,
capture_output=True,
@ -894,6 +896,7 @@ def _run_job_script(script_path: str) -> tuple[bool, str]:
timeout=script_timeout,
cwd=str(path.parent),
env=run_env,
**popen_kwargs,
)
stdout = (result.stdout or "").strip()
stderr = (result.stderr or "").strip()