tests/functional: simplify 'which' implementation
The 'access' check implies the file exists. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-6-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
0da341a78f
commit
dd6dfc012c
@ -25,7 +25,7 @@ def which(tool):
|
|||||||
paths=os.getenv('PATH')
|
paths=os.getenv('PATH')
|
||||||
for p in paths.split(os.path.pathsep):
|
for p in paths.split(os.path.pathsep):
|
||||||
p = os.path.join(p, tool)
|
p = os.path.join(p, tool)
|
||||||
if os.path.exists(p) and os.access(p, os.X_OK):
|
if os.access(p, os.X_OK):
|
||||||
return p
|
return p
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user