ToC Editor: Workaround an occasional error when closing on Windows if the file being edited is in a DropBox/antivirus prone area

This commit is contained in:
Kovid Goyal 2021-12-08 20:28:54 +05:30
parent 631bb7652f
commit 0f56a27b97
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -164,8 +164,14 @@ class ToCEditAction(InterfaceAction):
result_path = job['path'] + '.result'
if job['started'] and os.path.exists(result_path):
self.jobs.remove(job)
ret = -1
def read(result_path):
nonlocal ret
with open(result_path) as f:
ret = int(f.read().strip())
retry_on_fail(read, result_path)
retry_on_fail(os.remove, result_path)
if ret == 0:
db = self.gui.current_db