mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
distro-tool: handle garbage in error response
This commit is contained in:
parent
491610dc00
commit
72cdeda49e
@ -104,7 +104,13 @@ class MyUtility(object):
|
|||||||
return (0, subprocess.check_output(command.split(" "), stderr=_logfile))
|
return (0, subprocess.check_output(command.split(" "), stderr=_logfile))
|
||||||
except subprocess.CalledProcessError as cpe:
|
except subprocess.CalledProcessError as cpe:
|
||||||
if MyUtility.isPython3:
|
if MyUtility.isPython3:
|
||||||
return (cpe.returncode, cpe.output.decode("utf-8"))
|
# Clean up undecodable garbage in response (eg. libftdi1 error page)
|
||||||
|
output = bytearray()
|
||||||
|
for c in cpe.output:
|
||||||
|
if c <= 127:
|
||||||
|
output.append(c)
|
||||||
|
|
||||||
|
return (cpe.returncode, output.decode("utf-8"))
|
||||||
else:
|
else:
|
||||||
return (cpe.returncode, cpe.output)
|
return (cpe.returncode, cpe.output)
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user