未验证 提交 9f0f62bc 编写于 作者: A Amador Pahim

Merge branch 'ldoktor-broken-can-sudo'

Signed-off-by: NAmador Pahim <apahim@redhat.com>
......@@ -111,11 +111,14 @@ def can_sudo(cmd=None):
except path.CmdNotFoundError:
return False
if cmd: # Am I able to run the cmd or plain sudo id?
return not system(cmd, ignore_status=True, sudo=True)
elif system_output("id -u", ignore_status=True, sudo=True).strip() == "0":
return True
else:
try:
if cmd: # Am I able to run the cmd or plain sudo id?
return not system(cmd, ignore_status=True, sudo=True)
elif system_output("id -u", ignore_status=True, sudo=True).strip() == "0":
return True
else:
return False
except OSError: # Broken sudo binary
return False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册