Skip to content

Commit 1bf1919

Browse files
committed
pexpect: Set codec_errors to 'replace'
Don't crash if a guest produces non utf-8 output.
1 parent cce3a2b commit 1bf1919

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/pexpect_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def __init__(self):
2222
def spawn(self, *args, **kwargs):
2323
logging.debug("Spawning '%s'" % args)
2424
quiet = kwargs.pop('quiet', False)
25-
self.child = pexpect.spawn(*args, encoding='utf-8', echo=False, **kwargs)
25+
self.child = pexpect.spawn(*args, encoding='utf-8', codec_errors='replace',
26+
echo=False, **kwargs)
2627
if not quiet:
2728
self.log_to(sys.stdout)
2829

0 commit comments

Comments
 (0)