aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2017-08-23 18:46:38 -0700
committerRobert Yang <liezhi.yang@windriver.com>2017-08-23 23:15:23 -0700
commitf6d4e8bacf6f6586bf87ada3df07eaeac5296e57 (patch)
tree13d24860615c6cd223229a120c0f7b20d1787a36
parentdcb6cd19fb8c639cb844d116fb83827267f37421 (diff)
downloadopenembedded-core-contrib-rbt/ptest.tar.gz
openembedded-core-contrib-rbt/ptest.tar.bz2
openembedded-core-contrib-rbt/ptest.zip
core/target/ssh.py: use reader to handle partial datarbt/ptest
This can avoid UnicodeDecodeError error. Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-rw-r--r--meta/lib/oeqa/core/target/ssh.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index a2eafcd6f2..927d659525 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -6,6 +6,7 @@ import time
import select
import logging
import subprocess
+import codecs
from . import OETarget
@@ -206,12 +207,12 @@ def SSHCall(command, logger, timeout=None, **opts):
logger.debug('time: %s, endtime: %s' % (time.time(), endtime))
try:
if select.select([process.stdout], [], [], 5)[0] != []:
- data = os.read(process.stdout.fileno(), 1024)
+ reader = codecs.getreader('utf-8')(process.stdout)
+ data = reader.read(1024, 1024)
if not data:
process.stdout.close()
eof = True
else:
- data = data.decode("utf-8", errors='replace')
output += data
logger.debug('Partial data from SSH call: %s' % data)
endtime = time.time() + timeout