From db2f0e6f3180c4cb4a4f0253598e8e8adc15c4d0 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Fri, 19 Jan 2024 15:58:36 +0100 Subject: [PATCH] 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. --- api/geth_backend.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/geth_backend.go b/api/geth_backend.go index 83a77f72a..d2953a3e7 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -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")