diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index ea38b20c3d8..f0118164c2f 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -315,8 +315,10 @@ def run(self): cmd_stdout, cmd_stderr = out else: cmd_stdout = out - self.output = self.sanitize_output(cmd_stdout) - self.error = self.sanitize_output(cmd_stderr) + # Docker returns None when there's no stderr/stdout + # so we need to convert that to a string. + self.output = self.sanitize_output(cmd_stdout or "") + self.error = self.sanitize_output(cmd_stderr or "") cmd_ret = client.exec_inspect(exec_id=exec_cmd['Id']) self.exit_code = cmd_ret['ExitCode']