Skip to content

Commit d2157c8

Browse files
authored
Merge pull request #7473 from readthedocs/truncate-output
Truncate output at the start for large commands
2 parents 57273b8 + e9666df commit d2157c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

readthedocs/doc_builder/environments.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ def sanitize_output(self, output):
242242
self.build_env.build.get('id'),
243243
self.get_command(),
244244
)
245-
sanitized = sanitized[:allowed_length]
246-
sanitized += '\n\n\nOutput is too big. Chunked at {} bytes'.format(
247-
allowed_length,
245+
truncated_output = sanitized[-allowed_length:]
246+
sanitized = (
247+
'.. (truncated) ...\n'
248+
f'Output is too big. Truncated at {allowed_length} bytes.\n\n\n'
249+
f'{truncated_output}'
248250
)
249251

250252
return sanitized

0 commit comments

Comments
 (0)