twister: ignore unencodable unicode of west flash command.

sometimes there are some unencodable unicode chars from output
of west flash command, need to ignore them rather than reporting
an error.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
This commit is contained in:
Chen Peng1 2022-01-25 16:20:53 +08:00 committed by Anas Nashif
commit 5b102040c2

View file

@ -838,7 +838,8 @@ class DeviceHandler(Handler):
with subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) as proc:
try:
(stdout, stderr) = proc.communicate(timeout=30)
logger.debug(stdout.decode())
# ignore unencodable unicode chars
logger.debug(stdout.decode(errors = "ignore"))
if proc.returncode != 0:
self.instance.reason = "Device issue (Flash?)"