Revert "fix(cli): tolerate unreadable dirs when building systemd PATH"

This reverts commit 965610f922.
This commit is contained in:
Austin Pickett 2026-05-16 00:04:58 -04:00
parent 965610f922
commit 16ff9464a5

View file

@ -2103,19 +2103,6 @@ def _hermes_home_for_target_user(target_home_dir: str) -> str:
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]:
"""Build PATH directory list for service units, excluding non-existent dirs."""
if project_root is None:
@ -2124,21 +2111,21 @@ def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
candidates = []
venv_bin = project_root / "venv" / "bin"
if _path_usable_bindir(venv_bin):
if venv_bin.is_dir():
candidates.append(str(venv_bin))
elif sys.prefix != sys.base_prefix:
candidates.append(str(Path(sys.prefix) / "bin"))
node_bin = project_root / "node_modules" / ".bin"
if _path_usable_bindir(node_bin):
if node_bin.is_dir():
candidates.append(str(node_bin))
hermes_home = get_hermes_home()
hermes_node = hermes_home / "node" / "bin"
if _path_usable_bindir(hermes_node):
if hermes_node.is_dir():
candidates.append(str(hermes_node))
hermes_nm = hermes_home / "node_modules" / ".bin"
if _path_usable_bindir(hermes_nm):
if hermes_nm.is_dir():
candidates.append(str(hermes_nm))
return candidates