I have concerns that bad timing of the flow of data from the logger
might corrupt the output due to the way binary strings are handled
in qemurunner.
This simplifies the code to do the same thing it did before but much
more safely.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
reachedlogin = False
stopread = False
qemusock = None
- bootlog = ''
+ bootlog = b''
data = b''
while time.time() < endtime and not stopread:
try:
else:
data = data + sock.recv(1024)
if data:
- try:
- data = data.decode("utf-8", errors="surrogateescape")
- bootlog += data
- data = b''
- if re.search(".* login:", bootlog):
- self.server_socket = qemusock
- stopread = True
- reachedlogin = True
- self.logger.debug("Reached login banner")
- except UnicodeDecodeError:
- continue
+ bootlog += data
+ data = b''
+ if b' login:' in bootlog:
+ self.server_socket = qemusock
+ stopread = True
+ reachedlogin = True
+ self.logger.debug("Reached login banner")
else:
socklist.remove(sock)
sock.close()