Skip to content

Commit 8ddb549

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/git/repo_attribute.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ func (c *CheckAttributeReader) Run() error {
205205
return nil
206206
},
207207
})
208-
if err != nil && c.ctx.Err() != nil && err.Error() != "signal: killed" {
208+
if err != nil && // If there is an error we need to return but:
209+
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)
210+
err.Error() != "signal: killed" { // 2. We should not pass up errors due to the program being killed
209211
return fmt.Errorf("failed to run attr-check. Error: %w\nStderr: %s", err, stdErr.String())
210212
}
211213
return nil

0 commit comments

Comments
 (0)