From 16ff9464a5daae9b82bf2ce2c7de5ba8f80cfd40 Mon Sep 17 00:00:00 2001 From: Austin Pickett Date: Sat, 16 May 2026 00:04:58 -0400 Subject: [PATCH] Revert "fix(cli): tolerate unreadable dirs when building systemd PATH" This reverts commit 965610f922be5b2afb6fa412205077486734a433. --- hermes_cli/gateway.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index f2d6223f3de..a865bcaf8be 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -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