Skip to content

Commit dd52c08

Browse files
zeripathwxiaoguang
andauthored
Don't show context cancelled errors in attribute reader (#19006) (#19027)
Backport #19006 Fix #18997 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: wxiaoguang <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent b811b81 commit dd52c08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/git/repo_attribute.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ func (c *CheckAttributeReader) Run() error {
191191
}
192192
return nil
193193
})
194-
if err != nil && c.ctx.Err() != nil && err.Error() != "signal: killed" {
194+
if err != nil && // If there is an error we need to return but:
195+
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)
196+
err.Error() != "signal: killed" { // 2. We should not pass up errors due to the program being killed
195197
return fmt.Errorf("failed to run attr-check. Error: %w\nStderr: %s", err, stdErr.String())
196198
}
197199
return nil

0 commit comments

Comments
 (0)