mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
Revert "fix(cli): tolerate unreadable dirs when building systemd PATH"
This reverts commit 965610f922.
This commit is contained in:
parent
965610f922
commit
16ff9464a5
1 changed files with 4 additions and 17 deletions
|
|
@ -2103,19 +2103,6 @@ def _hermes_home_for_target_user(target_home_dir: str) -> str:
|
||||||
return str(current_hermes)
|
return str(current_hermes)
|
||||||
|
|
||||||
|
|
||||||
def _path_usable_bindir(path: Path) -> bool:
|
|
||||||
"""True iff ``path`` exists as a dir and we could stat/read it.
|
|
||||||
|
|
||||||
systemd unit generation may run under simulated ``sudo`` in tests via
|
|
||||||
``Path.home()`` → ``/root``; unprivileged users get ``PermissionError`` on
|
|
||||||
``/root/.hermes/…`` probes. Missing/unreadable dirs are treated as absent.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
return path.is_dir()
|
|
||||||
except OSError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
|
def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
|
||||||
"""Build PATH directory list for service units, excluding non-existent dirs."""
|
"""Build PATH directory list for service units, excluding non-existent dirs."""
|
||||||
if project_root is None:
|
if project_root is None:
|
||||||
|
|
@ -2124,21 +2111,21 @@ def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
|
||||||
candidates = []
|
candidates = []
|
||||||
|
|
||||||
venv_bin = project_root / "venv" / "bin"
|
venv_bin = project_root / "venv" / "bin"
|
||||||
if _path_usable_bindir(venv_bin):
|
if venv_bin.is_dir():
|
||||||
candidates.append(str(venv_bin))
|
candidates.append(str(venv_bin))
|
||||||
elif sys.prefix != sys.base_prefix:
|
elif sys.prefix != sys.base_prefix:
|
||||||
candidates.append(str(Path(sys.prefix) / "bin"))
|
candidates.append(str(Path(sys.prefix) / "bin"))
|
||||||
|
|
||||||
node_bin = project_root / "node_modules" / ".bin"
|
node_bin = project_root / "node_modules" / ".bin"
|
||||||
if _path_usable_bindir(node_bin):
|
if node_bin.is_dir():
|
||||||
candidates.append(str(node_bin))
|
candidates.append(str(node_bin))
|
||||||
|
|
||||||
hermes_home = get_hermes_home()
|
hermes_home = get_hermes_home()
|
||||||
hermes_node = hermes_home / "node" / "bin"
|
hermes_node = hermes_home / "node" / "bin"
|
||||||
if _path_usable_bindir(hermes_node):
|
if hermes_node.is_dir():
|
||||||
candidates.append(str(hermes_node))
|
candidates.append(str(hermes_node))
|
||||||
hermes_nm = hermes_home / "node_modules" / ".bin"
|
hermes_nm = hermes_home / "node_modules" / ".bin"
|
||||||
if _path_usable_bindir(hermes_nm):
|
if hermes_nm.is_dir():
|
||||||
candidates.append(str(hermes_nm))
|
candidates.append(str(hermes_nm))
|
||||||
|
|
||||||
return candidates
|
return candidates
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue