fix(gateway): ignore inaccessible service path dirs
This commit is contained in:
@@ -2110,24 +2110,30 @@ def _build_service_path_dirs(project_root: Path | None = None) -> list[str]:
|
|||||||
if project_root is None:
|
if project_root is None:
|
||||||
project_root = PROJECT_ROOT
|
project_root = PROJECT_ROOT
|
||||||
|
|
||||||
|
def _is_dir(path: Path) -> bool:
|
||||||
|
try:
|
||||||
|
return path.is_dir()
|
||||||
|
except OSError:
|
||||||
|
return False
|
||||||
|
|
||||||
candidates = []
|
candidates = []
|
||||||
|
|
||||||
venv_bin = project_root / "venv" / "bin"
|
venv_bin = project_root / "venv" / "bin"
|
||||||
if venv_bin.is_dir():
|
if _is_dir(venv_bin):
|
||||||
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 node_bin.is_dir():
|
if _is_dir(node_bin):
|
||||||
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 hermes_node.is_dir():
|
if _is_dir(hermes_node):
|
||||||
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 hermes_nm.is_dir():
|
if _is_dir(hermes_nm):
|
||||||
candidates.append(str(hermes_nm))
|
candidates.append(str(hermes_nm))
|
||||||
|
|
||||||
return candidates
|
return candidates
|
||||||
|
|||||||
Reference in New Issue
Block a user