diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 394aa06e697..282572b41b3 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -258,11 +258,8 @@ def run(self): stderr=True, ) - output = client.exec_start(exec_id=exec_cmd['Id'], stream=False) - try: - self.output = output.decode('utf-8', 'replace') - except (TypeError, AttributeError): - self.output = '' + cmd_output = client.exec_start(exec_id=exec_cmd['Id'], stream=False) + self.output = self.sanitize_output(cmd_output) cmd_ret = client.exec_inspect(exec_id=exec_cmd['Id']) self.exit_code = cmd_ret['ExitCode']