Skip to content

Commit bae84f6

Browse files
authored
Merge pull request #9257 from readthedocs/humitos/solve-build-issue
2 parents 8f68c26 + 7332a16 commit bae84f6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

readthedocs/doc_builder/environments.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def sanitize_output(self, output):
194194
# https://code.djangoproject.com/ticket/28201
195195
sanitized = sanitized.replace('\x00', '')
196196
except (TypeError, AttributeError):
197-
sanitized = None
197+
sanitized = ""
198198

199199
# Chunk the output data to be less than ``DATA_UPLOAD_MAX_MEMORY_SIZE``
200200
output_length = len(output) if output else 0
@@ -315,10 +315,8 @@ def run(self):
315315
cmd_stdout, cmd_stderr = out
316316
else:
317317
cmd_stdout = out
318-
# Docker returns None when there's no stderr/stdout
319-
# so we need to convert that to a string.
320-
self.output = self.sanitize_output(cmd_stdout or "")
321-
self.error = self.sanitize_output(cmd_stderr or "")
318+
self.output = self.sanitize_output(cmd_stdout)
319+
self.error = self.sanitize_output(cmd_stderr)
322320
cmd_ret = client.exec_inspect(exec_id=exec_cmd['Id'])
323321
self.exit_code = cmd_ret['ExitCode']
324322

readthedocs/rtd_tests/tests/test_doc_building.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def test_error_output(self):
255255
cmd = BuildCommand(['/bin/bash', '-c', 'echo -n FOOBAR 1>&2'])
256256
cmd.run()
257257
self.assertEqual(cmd.output, 'FOOBAR')
258-
self.assertIsNone(cmd.error)
258+
self.assertEqual(cmd.error, "")
259259

260260
def test_sanitize_output(self):
261261
cmd = BuildCommand(['/bin/bash', '-c', 'echo'])

0 commit comments

Comments
 (0)