mirror of
https://github.com/GothenburgBitFactory/task-timewarrior-hook.git
synced 2025-06-26 10:54:27 +02:00
Remove DB file instead of truncating it
Taskwarrior3 uses a SQLite DB file to store the task data. Truncating the file corrupts the database, letting the tests fail. Removing the DB file resets Taskwarrior as well, and works with 2 and 3.
This commit is contained in:
parent
98298a2bdf
commit
2475f1ba0e
1 changed files with 2 additions and 2 deletions
|
@ -328,8 +328,8 @@ class Task(object):
|
|||
for filename in os.listdir(folder):
|
||||
file_path = os.path.join(folder, filename)
|
||||
try:
|
||||
print("Emptying {}".format(file_path))
|
||||
print("Removing {}".format(file_path))
|
||||
if os.path.isfile(file_path) or os.path.islink(file_path):
|
||||
open(file_path, 'w').close()
|
||||
os.remove(file_path)
|
||||
except Exception as e:
|
||||
print("Failed to delete {}. Reason: {}".format(file_path, e))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue