mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(gateway): ignore inaccessible service path dirs
This commit is contained in:
parent
1a82b7a1ff
commit
bc7c608d54
1 changed files with 10 additions and 4 deletions
|
|
@ -2110,24 +2110,30 @@ def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
|
|||
if project_root is None:
|
||||
project_root = PROJECT_ROOT
|
||||
|
||||
def _is_dir(path: Path) -> bool:
|
||||
try:
|
||||
return path.is_dir()
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
candidates = []
|
||||
|
||||
venv_bin = project_root / "venv" / "bin"
|
||||
if venv_bin.is_dir():
|
||||
if _is_dir(venv_bin):
|
||||
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 node_bin.is_dir():
|
||||
if _is_dir(node_bin):
|
||||
candidates.append(str(node_bin))
|
||||
|
||||
hermes_home = get_hermes_home()
|
||||
hermes_node = hermes_home / "node" / "bin"
|
||||
if hermes_node.is_dir():
|
||||
if _is_dir(hermes_node):
|
||||
candidates.append(str(hermes_node))
|
||||
hermes_nm = hermes_home / "node_modules" / ".bin"
|
||||
if hermes_nm.is_dir():
|
||||
if _is_dir(hermes_nm):
|
||||
candidates.append(str(hermes_nm))
|
||||
|
||||
return candidates
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue