Handle command being absent in which.
This commit is contained in:
parent
c651b061ef
commit
7547b28dfd
1 changed files with 6 additions and 1 deletions
|
@ -121,7 +121,12 @@ def get_user(session):
|
|||
|
||||
|
||||
def which(session, name):
|
||||
ret = session.check_output(["which", name], cwd="/").decode().strip()
|
||||
try:
|
||||
ret = session.check_output(["which", name], cwd="/").decode().strip()
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.returncode == 1:
|
||||
return None
|
||||
raise
|
||||
if not ret:
|
||||
return None
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue