Add which.

This commit is contained in:
Jelmer Vernooij 2021-03-23 21:11:26 +00:00
parent 415a183d79
commit 4d8571556a
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8

View file

@ -118,3 +118,10 @@ def run_with_tee(session: Session, args: List[str], **kwargs):
def get_user(session): def get_user(session):
return session.check_output(["echo", "$USER"], cwd="/").decode().strip() return session.check_output(["echo", "$USER"], cwd="/").decode().strip()
def which(session, name):
ret = session.check_output(["which", name], cwd="/").decode().strip()
if not ret:
return None
return ret