Merge remote-tracking branch 'origin/pr/3388'
This commit is contained in:
commit
2b3250144b
@ -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)
|
||||
|
@ -63,6 +63,20 @@ def test_start(proc, qtbot, message_mock, py_proc):
|
||||
assert qutescheme.spawn_output == proc._spawn_format(stdout="test")
|
||||
|
||||
|
||||
def test_stdout_malformed_utf8(proc, qtbot, message_mock, py_proc):
|
||||
"""Test handling malformed utf-8 in stdout."""
|
||||
with qtbot.waitSignals([proc.started, proc.finished], timeout=10000,
|
||||
order='strict'):
|
||||
argv = py_proc(r"""
|
||||
import sys
|
||||
sys.stdout.buffer.write(b"A\x80B")
|
||||
sys.exit(0)
|
||||
""")
|
||||
proc.start(*argv)
|
||||
assert not message_mock.messages
|
||||
assert qutescheme.spawn_output == proc._spawn_format(stdout="A\ufffdB")
|
||||
|
||||
|
||||
def test_start_verbose(proc, qtbot, message_mock, py_proc):
|
||||
"""Test starting a process verbosely."""
|
||||
proc.verbose = True
|
||||
|
Loading…
Reference in New Issue
Block a user