diff options
author | zeripath <art27@cantab.net> | 2020-08-11 21:05:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 21:05:34 +0100 |
commit | 74bd9691c685942798f2761607731697498ceeae (patch) | |
tree | 531d661263b839ccf8aa6af73bfb6710984f0dd9 /contrib/pr | |
parent | faa676cc8b4419ac56fbf9d009ea8c6b79834024 (diff) | |
download | gitea-74bd9691c685942798f2761607731697498ceeae.tar.gz gitea-74bd9691c685942798f2761607731697498ceeae.zip |
Re-attempt to delete temporary upload if the file is locked by another process (#12447)
Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util.
Fix #12339
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'contrib/pr')
-rw-r--r-- | contrib/pr/checkout.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/pr/checkout.go b/contrib/pr/checkout.go index b4cf80ed4c..8fe1aa4206 100644 --- a/contrib/pr/checkout.go +++ b/contrib/pr/checkout.go @@ -29,6 +29,7 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/external" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers" "code.gitea.io/gitea/routers/routes" @@ -108,8 +109,8 @@ func runPR() { os.Exit(1) } models.LoadFixtures() - os.RemoveAll(setting.RepoRootPath) - os.RemoveAll(models.LocalCopyPath()) + util.RemoveAll(setting.RepoRootPath) + util.RemoveAll(models.LocalCopyPath()) com.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath) log.Printf("[PR] Setting up router\n") @@ -141,20 +142,20 @@ func runPR() { log.Printf("[PR] Cleaning up ...\n") /* - if err = os.RemoveAll(setting.Indexer.IssuePath); err != nil { - fmt.Printf("os.RemoveAll: %v\n", err) + if err = util.RemoveAll(setting.Indexer.IssuePath); err != nil { + fmt.Printf("util.RemoveAll: %v\n", err) os.Exit(1) } - if err = os.RemoveAll(setting.Indexer.RepoPath); err != nil { + if err = util.RemoveAll(setting.Indexer.RepoPath); err != nil { fmt.Printf("Unable to remove repo indexer: %v\n", err) os.Exit(1) } */ - if err = os.RemoveAll(setting.RepoRootPath); err != nil { - log.Fatalf("os.RemoveAll: %v\n", err) + if err = util.RemoveAll(setting.RepoRootPath); err != nil { + log.Fatalf("util.RemoveAll: %v\n", err) } - if err = os.RemoveAll(setting.AppDataPath); err != nil { - log.Fatalf("os.RemoveAll: %v\n", err) + if err = util.RemoveAll(setting.AppDataPath); err != nil { + log.Fatalf("util.RemoveAll: %v\n", err) } } |