chore: refine error handling for bind mount related issues
Some checks are pending
build / build (push) Waiting to run
Some checks are pending
build / build (push) Waiting to run
This commit is contained in:
parent
6cd9860681
commit
b35eaa902a
|
|
@ -192,12 +192,15 @@ func writeFileAtomic(path string, data []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := osRename(tmp, path); err != nil {
|
if err := osRename(tmp, path); err != nil {
|
||||||
if errors.Is(err, syscall.EBUSY) {
|
if errors.Is(err, syscall.EBUSY) || errors.Is(err, syscall.ETXTBSY) {
|
||||||
if writeErr := osWriteFile(path, data, 0o644); writeErr != nil {
|
if writeErr := osWriteFile(path, data, 0o644); writeErr != nil {
|
||||||
_ = os.Remove(tmp)
|
_ = os.Remove(tmp)
|
||||||
return writeErr
|
return writeErr
|
||||||
}
|
}
|
||||||
return os.Remove(tmp)
|
if removeErr := os.Remove(tmp); removeErr != nil && !os.IsNotExist(removeErr) {
|
||||||
|
// best effort cleanup; ignore failure
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
_ = os.Remove(tmp)
|
_ = os.Remove(tmp)
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue