Handle command being absent in which.

This commit is contained in:
Jelmer Vernooij 2021-03-23 21:37:08 +00:00
parent c651b061ef
commit 7547b28dfd

View file

@ -121,7 +121,12 @@ def get_user(session):
def which(session, name): 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: if not ret:
return None return None
return ret return ret