From ec6f30318bc37212c15f4c7c814ae9b2bc15cc93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 5 Jan 2025 16:12:14 +0100 Subject: [PATCH] Remove shared memory and write-ahead log files when dropping SQLite database Since 6837a618f53d SQLite may create such temporary files. Closes #13794 --- trytond/trytond/backend/sqlite/database.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trytond/trytond/backend/sqlite/database.py b/trytond/trytond/backend/sqlite/database.py index dc4863cd55..49a9723879 100644 --- a/trytond/trytond/backend/sqlite/database.py +++ b/trytond/trytond/backend/sqlite/database.py @@ -596,8 +596,14 @@ class Database(DatabaseInterface): return if os.sep in database_name: return - os.remove(os.path.join(config.get('database', 'path'), - database_name + '.sqlite')) + file = os.path.join( + config.get('database', 'path'), database_name + '.sqlite') + os.remove(file) + for suffix in ['-shm', '-wal']: + try: + os.remove(file + suffix) + except FileNotFoundError: + pass def list(self, hostname=None): res = []