Replace malformed utf-8 characters in spawn output.

Previously this simply crashed if there was ever malformed utf-8 in the
stderr or stdout streams, perhaps as a result of an incorrectly spawned
command. See e.g. #3222
This commit is contained in:
George Edward Bulmer 2017-12-12 22:23:33 +00:00
parent 22434f4d1b
commit 16a9948759

View File

@ -98,8 +98,10 @@ class GUIProcess(QObject):
log.procs.debug("Process finished with code {}, status {}.".format(
code, status))
stderr = bytes(self._proc.readAllStandardError()).decode('utf-8')
stdout = bytes(self._proc.readAllStandardOutput()).decode('utf-8')
stderr = bytes(self._proc.readAllStandardError()).decode('utf-8',
'replace')
stdout = bytes(self._proc.readAllStandardOutput()).decode('utf-8',
'replace')
qutescheme.spawn_output = self._spawn_format(code, status,
stdout, stderr)