Rely on Python 3 to decode stdout.

This commit is contained in:
Markus Unterwaditzer 2014-09-13 14:56:29 +02:00
parent 14f7da4e04
commit 37551b376f

View file

@ -187,15 +187,12 @@ def _password_from_command(username, host):
command[0] = expand_path(command[0]) command[0] = expand_path(command[0])
try: try:
proc = subprocess.Popen(command + [username, host], stdout = subprocess.check_output(command + [username, host],
stdout=subprocess.PIPE) universal_newlines=True)
password = proc.stdout.read().decode('utf-8').strip() return stdout.strip()
except OSError as e: except OSError as e:
logger.warning('Failed to execute command: {}\n{}'. logger.warning('Failed to execute command: {}\n{}'.
format(' '.join(command), str(e))) format(' '.join(command), str(e)))
return None
return password
class _FingerprintAdapter(requests.adapters.HTTPAdapter): class _FingerprintAdapter(requests.adapters.HTTPAdapter):