Add protection for truncate() call

This commit is contained in:
allegroai 2024-02-29 13:51:09 +02:00
parent 05a65548da
commit 6fbd70786e

View File

@ -1883,8 +1883,13 @@ class Worker(ServiceCommandSection):
pos = f.tell() pos = f.tell()
else: else:
# buffered - read everything and truncate # buffered - read everything and truncate
# noinspection PyBroadException
try:
f.truncate(0) f.truncate(0)
pos = 0 pos = 0
except Exception:
pos = f.tell()
# skip the previously printed lines, # skip the previously printed lines,
blines = binary_text.split(b'\n') if binary_text else [] blines = binary_text.split(b'\n') if binary_text else []
if not blines: if not blines: