catch exceptions in which_string (#40935)
This commit is contained in:
parent
c232bf435a
commit
10ba172611
1 changed files with 5 additions and 2 deletions
|
@ -330,8 +330,11 @@ def add_extra_search_paths(paths):
|
||||||
for candidate_item in candidate_items:
|
for candidate_item in candidate_items:
|
||||||
for directory in search_paths:
|
for directory in search_paths:
|
||||||
exe = directory / candidate_item
|
exe = directory / candidate_item
|
||||||
if exe.is_file() and os.access(str(exe), os.X_OK):
|
try:
|
||||||
return str(exe)
|
if exe.is_file() and os.access(str(exe), os.X_OK):
|
||||||
|
return str(exe)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
if required:
|
if required:
|
||||||
raise CommandNotFoundError("spack requires '%s'. Make sure it is in your path." % args[0])
|
raise CommandNotFoundError("spack requires '%s'. Make sure it is in your path." % args[0])
|
||||||
|
|
Loading…
Reference in a new issue