Skip to content

Commit

Permalink
Fix logWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
discordianfish committed Mar 25, 2024
1 parent b0fdc1b commit a2f2221
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion initializer/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ type logWriter struct {
func (l *logWriter) Write(p []byte) (n int, err error) {
s := 0
for i := 0; i < len(p); i++ {
if p[i] == '\r' {
if p[i] == '\n' {
l.logger.Log("msg", string(p[s:i]))
s = i + 1
}
}

if s < len(p) { // Check for remaining text after the last newline character
l.logger.Log("msg", string(p[s:]))
}

return len(p), nil
}

Expand Down

0 comments on commit a2f2221

Please sign in to comment.