1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/ssh: Ensure the detected sshpass is used

Since we detect the sshpass tool using which(), ensure that the code
uses that instead of just relying on PATH.
This commit is contained in:
Douglas Raillard 2023-06-26 15:28:43 +01:00 committed by Marc Bonnici
parent c39d40c6f8
commit f30fb0b3fd

View File

@ -1604,13 +1604,15 @@ class AndroidGem5Connection(Gem5Connection):
gem5_logger.info("Android booted")
def _give_password(password, command):
if not sshpass:
raise HostError('Must have sshpass installed on the host in order to use password-based auth.')
pass_template = "sshpass -p {} "
pass_string = pass_template.format(quote(password))
redacted_string = pass_template.format(quote('<redacted>'))
if sshpass:
pass_template = "{} -p {} "
pass_string = pass_template.format(quote(sshpass), quote(password))
redacted_string = pass_template.format(quote(sshpass), quote('<redacted>'))
return (pass_string + command, redacted_string + command)
else:
raise HostError('Must have sshpass installed on the host in order to use password-based auth.')
def process_backspaces(text):