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()
else:
# buffered - read everything and truncate
f.truncate(0)
pos = 0
# noinspection PyBroadException
try:
f.truncate(0)
pos = 0
except Exception:
pos = f.tell()
# skip the previously printed lines,
blines = binary_text.split(b'\n') if binary_text else []
if not blines: