mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix(gateway): move PATH bootstrap below imports, gate to POSIX
Follow-up to #3850's cherry-pick: keeps the fix but avoids the mid-import E402 wart and skips the POSIX system dirs on Windows.
This commit is contained in:
parent
1b7853d7bc
commit
619db0175d
1 changed files with 9 additions and 8 deletions
|
|
@ -12,20 +12,21 @@ import shlex
|
|||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
|
||||
# Ensure /bin and /usr/bin are on PATH so launchctl/systemctl are discoverable
|
||||
# when running under UV's bundled Python which ships a minimal PATH.
|
||||
_sys_dirs = {"/bin", "/usr/bin", "/usr/sbin", "/sbin"}
|
||||
_path_dirs = set(os.environ.get("PATH", "").split(os.pathsep))
|
||||
_missing = _sys_dirs - _path_dirs
|
||||
if _missing:
|
||||
os.environ["PATH"] = os.environ.get("PATH", "") + os.pathsep + os.pathsep.join(sorted(_missing))
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
# Ensure /bin and /usr/bin are on PATH so launchctl/systemctl are discoverable
|
||||
# when running under UV's bundled Python which ships a minimal PATH (#3849).
|
||||
if os.name == "posix":
|
||||
_sys_dirs = {"/bin", "/usr/bin", "/usr/sbin", "/sbin"}
|
||||
_path_dirs = set(os.environ.get("PATH", "").split(os.pathsep))
|
||||
_missing = _sys_dirs - _path_dirs
|
||||
if _missing:
|
||||
os.environ["PATH"] = os.environ.get("PATH", "") + os.pathsep + os.pathsep.join(sorted(_missing))
|
||||
|
||||
PROJECT_ROOT = Path(__file__).parent.parent.resolve()
|
||||
|
||||
from gateway.status import terminate_pid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue