Trim newline in log message (#6)

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/6
This commit is contained in:
Jason Song 2022-12-02 16:07:23 +08:00
parent 0f97dd873a
commit 0cbdbd36b6

View File

@ -285,7 +285,7 @@ func (r *Reporter) parseResult(result interface{}) (runnerv1.Result, bool) {
} }
func (r *Reporter) parseLogRow(entry *log.Entry) *runnerv1.LogRow { func (r *Reporter) parseLogRow(entry *log.Entry) *runnerv1.LogRow {
content := strings.TrimSuffix(entry.Message, "\r\n") content := strings.TrimRightFunc(entry.Message, func(r rune) bool { return r == '\r' || r == '\n' })
content = r.logReplacer.Replace(content) content = r.logReplacer.Replace(content)
return &runnerv1.LogRow{ return &runnerv1.LogRow{
Time: timestamppb.New(entry.Time), Time: timestamppb.New(entry.Time),