Skip to content

Commit

Permalink
Merge pull request #4166 from Flamefire/fix-check-os-dep
Browse files Browse the repository at this point in the history
fix use of `locate` in `check_os_dependency`
  • Loading branch information
boegel authored Feb 1, 2023
2 parents 2d906da + ecad22e commit e4506c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,14 @@ def check_os_dependency(dep):

# try locate if it's available
if not found and which('locate'):
cmd = 'locate --regexp "/%s$"' % dep
found = run_cmd(cmd, simple=True, log_all=False, log_ok=False, force_in_dry_run=True, trace=False,
stream_output=False)
cmd = 'locate -c --regexp "/%s$"' % dep
out, ec = run_cmd(cmd, simple=False, log_all=False, log_ok=False, force_in_dry_run=True, trace=False,
stream_output=False)
try:
found = (ec == 0 and int(out.strip()) > 0)
except ValueError:
# Returned something else than an int -> Error
found = False

return found

Expand Down

0 comments on commit e4506c1

Please sign in to comment.