Skip to content

Commit c7ec21a

Browse files
committed
Limit stdout tracelog to actual stdout
Related go-gitea#16243 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 622f1e7 commit c7ec21a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/git/command.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ func (c *Command) RunInDirTimeoutEnv(env []string, timeout time.Duration, dir st
199199
return nil, ConcatenateError(err, stderr.String())
200200
}
201201
if stdout.Len() > 0 && log.IsTrace() {
202-
log.Trace("Stdout:\n %s", stdout.Bytes()[:1024])
202+
tracelen := stdout.Len()
203+
if tracelen > 1024 {
204+
tracelen = 1024
205+
}
206+
log.Trace("Stdout:\n %s", stdout.Bytes()[:tracelen])
203207
}
204208
return stdout.Bytes(), nil
205209
}

0 commit comments

Comments
 (0)