fix: closing tmp db file after creation

Changes done in this commit solve the " The process cannot access the file because it is being used by another process." error
which was noticeable on Windows while migrating a profile keypair to a Keycard.
This commit is contained in:
Sale Djenic 2024-01-19 15:58:36 +01:00 committed by saledjenic
parent 9c0526f7d9
commit db2f0e6f31
1 changed files with 5 additions and 1 deletions

View File

@ -1090,10 +1090,14 @@ func (b *GethStatusBackend) createTempDBFile(pattern string) (tmpDbPath string,
if err != nil {
return
}
err = file.Close()
if err != nil {
return
}
tmpDbPath = file.Name()
cleanup = func() {
filePath := file.Name()
_ = file.Close()
_ = os.Remove(filePath)
_ = os.Remove(filePath + "-wal")
_ = os.Remove(filePath + "-shm")