Skip to content

Commit

Permalink
Don't show context cancelled errors in attribute reader (#19006) (#19027
Browse files Browse the repository at this point in the history
)

Backport #19006

Fix #18997

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
  • Loading branch information
zeripath and wxiaoguang committed Mar 8, 2022
1 parent b811b81 commit dd52c08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/git/repo_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ func (c *CheckAttributeReader) Run() error {
}
return nil
})
if err != nil && c.ctx.Err() != nil && err.Error() != "signal: killed" {
if err != nil && // If there is an error we need to return but:
c.ctx.Err() != err && // 1. Ignore the context error if the context is cancelled or exceeds the deadline (RunWithContext could return c.ctx.Err() which is Canceled or DeadlineExceeded)
err.Error() != "signal: killed" { // 2. We should not pass up errors due to the program being killed
return fmt.Errorf("failed to run attr-check. Error: %w\nStderr: %s", err, stdErr.String())
}
return nil
Expand Down

0 comments on commit dd52c08

Please sign in to comment.