diff options
author | zeripath <art27@cantab.net> | 2021-07-15 16:46:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 11:46:07 -0400 |
commit | 33a8eec33e975a74f1718a83e99eb6abc7662a19 (patch) | |
tree | d000ff3f37d417e9d03d15d070ed6fecf9c56636 /cmd | |
parent | aed086f8b021f5724ff1449ceb9f44dc28749a97 (diff) | |
download | gitea-33a8eec33e975a74f1718a83e99eb6abc7662a19.tar.gz gitea-33a8eec33e975a74f1718a83e99eb6abc7662a19.zip |
Retry rename on lock induced failures (#16435)
* Retry rename on lock induced failures
Due to external locking on Windows it is possible for an
os.Rename to fail if the files or directories are being
used elsewhere.
This PR simply suggests retrying the rename again similar
to how we handle the os.Remove problems.
Fix #16427
Signed-off-by: Andrew Thornton <art27@cantab.net>
* resolve CI fail
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/embedded.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/embedded.go b/cmd/embedded.go index 363b85c066..528f32402e 100644 --- a/cmd/embedded.go +++ b/cmd/embedded.go @@ -19,6 +19,7 @@ import ( "code.gitea.io/gitea/modules/public" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/templates" + "code.gitea.io/gitea/modules/util" "github.com/gobwas/glob" "github.com/urfave/cli" @@ -271,7 +272,7 @@ func extractAsset(d string, a asset, overwrite, rename bool) error { } else if !fi.Mode().IsRegular() { return fmt.Errorf("%s already exists, but it's not a regular file", dest) } else if rename { - if err := os.Rename(dest, dest+".bak"); err != nil { + if err := util.Rename(dest, dest+".bak"); err != nil { return fmt.Errorf("Error creating backup for %s: %v", dest, err) } // Attempt to respect file permissions mask (even if user:group will be set anew) |