Skip to content

Commit 4b89ee8

Browse files
authored
Merge pull request #20 from MagnusS/fix-utf8
Replace utf-8 errors when decoding stdout
2 parents 9f52d08 + 27eb78b commit 4b89ee8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vmrunner/vmrunner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def read_until_EOT(self):
320320
def readline(self):
321321
if self._proc.poll():
322322
raise Exception("Process completed")
323-
return self._proc.stdout.readline().decode("utf-8")
323+
return self._proc.stdout.readline().decode("utf-8", errors="replace")
324324

325325

326326
def writeline(self, line):
@@ -662,7 +662,7 @@ def read_until_EOT(self):
662662
chars = ""
663663

664664
while (not self._proc.poll()):
665-
char = self._proc.stdout.read(1).decode("utf-8")
665+
char = self._proc.stdout.read(1).decode("utf-8", errors="replace")
666666
if char == chr(4):
667667
return chars
668668
chars += char
@@ -673,7 +673,7 @@ def read_until_EOT(self):
673673
def readline(self):
674674
if self._proc.poll():
675675
raise Exception("Process completed")
676-
return self._proc.stdout.readline().decode("utf-8")
676+
return self._proc.stdout.readline().decode("utf-8", errors="replace")
677677

678678

679679
def writeline(self, line):
@@ -947,7 +947,7 @@ def boot(self, timeout = 60, multiboot = True, debug = False, kernel_args = "boo
947947
try:
948948
line = self._hyper.readline()
949949
except Exception as e:
950-
print(color.WARNING("Exception thrown while waiting for vm output"))
950+
print(color.WARNING("Exception thrown while waiting for vm output: %s" % e))
951951
break
952952

953953
if line and self.find_exit_status(line) == None:

0 commit comments

Comments
 (0)