Skip to content

Commit 5bdb653

Browse files
erikarvstedtJon
authored andcommitted
test-driver.py: fix decoding of VM output
The codec format 'unicode_escape' was introduced in 52ee102 to handle undecodable bytes in boot menus. This made the problem worse as unicode chars outside of iso-8859-1 produce garbled output and valid utf-8 strings (such as "\x" ) trigger decoding errors. Fix this by using the default 'utf-8' codec and by explicitly ignoring decoding errors.
1 parent caa435f commit 5bdb653

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

nixos/lib/test-driver/test-driver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ def create_socket(path: str) -> socket.socket:
704704

705705
def process_serial_output() -> None:
706706
for _line in self.process.stdout:
707-
line = _line.decode("unicode_escape").replace("\r", "").rstrip()
707+
# Ignore undecodable bytes that may occur in boot menus
708+
line = _line.decode(errors="ignore").replace("\r", "").rstrip()
708709
eprint("{} # {}".format(self.name, line))
709710
self.logger.enqueue({"msg": line, "machine": self.name})
710711

0 commit comments

Comments
 (0)