nixos/test-driver: handle decoding errors in Machine.execute
The output of a command is not guaranteed to be valid UTF-8, so the decoding can fail raising UnicodeDecodeError. If this happens during a `succeeds` the check will be erroneously marked failed. This changes the error handling to the "replace" mode, where invalid codepoints are replaced with � (REPLACEMENT CHARACTER U+FFFD) and the decoding can go on.
This commit is contained in:
parent
f2929eb949
commit
067d688b16
1 changed files with 1 additions and 1 deletions
|
@ -545,7 +545,7 @@ class Machine:
|
|||
self.shell.send("echo ${PIPESTATUS[0]}\n".encode())
|
||||
rc = int(self._next_newline_closed_block_from_shell().strip())
|
||||
|
||||
return (rc, output.decode())
|
||||
return (rc, output.decode(errors="replace"))
|
||||
|
||||
def shell_interact(self, address: Optional[str] = None) -> None:
|
||||
"""Allows you to interact with the guest shell for debugging purposes.
|
||||
|
|
Loading…
Reference in a new issue