File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 3838log = structlog .get_logger (__name__ )
3939
4040
41+ def _truncate_output (output ):
42+ if output is None :
43+ return ""
44+ output_lines = output .split ("\n " )
45+ if len (output_lines ) <= 20 :
46+ return output
47+ return "\n " .join (output_lines [:10 ] + [" ..Output Truncated.. " ] + output_lines [- 10 :])
48+
49+
4150class BuildCommand (BuildCommandResultMixin ):
4251 """
4352 Wrap command execution for execution in build environments.
@@ -548,15 +557,11 @@ def run_command_class(
548557 if build_cmd .failed :
549558 if warn_only :
550559 msg = "Command failed"
551- build_output = ""
552- if build_cmd .output :
553- build_output += "\n " .join (build_cmd .output .split ("\n " )[:10 ])
554- build_output += "\n ..Output Truncated.. \n "
555- build_output += "\n " .join (build_cmd .output .split ("\n " )[- 10 :])
556560 log .warning (
557561 msg ,
558562 command = build_cmd .get_command (),
559- output = build_output ,
563+ output = _truncate_output (build_cmd .output ),
564+ stderr = _truncate_output (build_cmd .error ),
560565 exit_code = build_cmd .exit_code ,
561566 project_slug = self .project .slug if self .project else "" ,
562567 version_slug = self .version .slug if self .version else "" ,
You can’t perform that action at this time.
0 commit comments