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

Merge branch 'ldoktor-broken-can-sudo'

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