migrate.py: python3: when there is no output do not print the heading

Also don't try to decode a possibly None value.

Signed-off-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
Uri Lublin 2020-02-20 16:54:14 +02:00
parent 7318565ecc
commit 77ae94a214

View File

@ -216,9 +216,13 @@ class Migrator(object):
dead.wait()
new_spice_port = dead.spice_port
new_qmp_filename = dead.qmp_filename
self.log.write("# STDOUT dead %s\n" % dead.pid)
outstr = dead.stdout.read().decode(encoding='utf-8', errors='ignore')
self.log.write(outstr)
outstr = dead.stdout.read()
if outstr:
outstr = outstr.decode(encoding='utf-8', errors='ignore')
self.log.write("# STDOUT dead %s\n" % dead.pid)
self.log.write(outstr)
del dead
self.active = self.target
self.target = start_qemu(spice_port=new_spice_port,