diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 35e3b898ec..8debf518c7 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -169,6 +169,10 @@ def _find_matches_in_path(cls, compiler_names, detect_version, *path): checks = [] for directory in path: + if not (os.path.isdir(directory) and + os.access(directory, os.R_OK | os.X_OK)): + continue + files = os.listdir(directory) for exe in files: full_path = join_path(directory, exe)