diff options
author | zeripath <art27@cantab.net> | 2022-03-08 08:30:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 08:30:14 +0000 |
commit | 8ddb5490e8a36393916846ede746dce49f4fade6 (patch) | |
tree | 481de7b027da1007aefb7f6e4141fea7f6eb579b | |
parent | 78b38a5ccc1181f7224700f07148c171ce88c938 (diff) | |
download | gitea-8ddb5490e8a36393916846ede746dce49f4fade6.tar.gz gitea-8ddb5490e8a36393916846ede746dce49f4fade6.zip |
Don't show context cancelled errors in attribute reader (#19006)
Fix #18997
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r-- | modules/git/repo_attribute.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/git/repo_attribute.go b/modules/git/repo_attribute.go index 772ee6ad12..ce24b0a7a3 100644 --- a/modules/git/repo_attribute.go +++ b/modules/git/repo_attribute.go @@ -205,7 +205,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 |