some fixes

This commit is contained in:
2026-06-10 10:19:25 +03:00
parent 1ef3973a15
commit 2ebf193695
3 changed files with 22 additions and 1 deletions

View File

@@ -86,6 +86,13 @@ func writeBuildText(w io.Writer, b *runner.BuildRun, multi bool) {
fmt.Fprintf(w, "│ %s\n", line)
}
}
if tr.Status != runner.StatusPass && strings.TrimSpace(tr.ActualStderr) != "" {
fmt.Fprintf(w, "│ ── stderr ──\n")
for _, line := range clampLines(tr.ActualStderr, 10) {
fmt.Fprintf(w, "│ %s\n", line)
}
}
}
fmt.Fprintf(w, "└─\n")
}
@@ -265,6 +272,18 @@ func extractTotalScore(data []byte) (float64, error) {
return header.TotalScore, nil
}
// clampLines returns up to max lines of s (trailing newline ignored), appending
// a truncation note when more lines were omitted.
func clampLines(s string, max int) []string {
s = strings.TrimRight(s, "\n")
lines := strings.Split(s, "\n")
if len(lines) <= max {
return lines
}
out := append([]string{}, lines[:max]...)
return append(out, fmt.Sprintf("... (%d more lines)", len(lines)-max))
}
func humanBytes(n int64) string {
const (
KiB = 1024