mute exception on zip abort

This commit is contained in:
ed 2022-07-25 01:20:38 +02:00
parent 10430b347f
commit 2fb1e6dab8
2 changed files with 46 additions and 41 deletions

View file

@ -65,6 +65,7 @@ class StreamTar(StreamArc):
w.start()
def gen(self) -> Generator[Optional[bytes], None, None]:
try:
while True:
buf = self.qfile.q.get()
if not buf:
@ -74,6 +75,7 @@ class StreamTar(StreamArc):
yield buf
yield None
finally:
if self.errf:
bos.unlink(self.errf["ap"])

View file

@ -272,6 +272,7 @@ class StreamZip(StreamArc):
def gen(self) -> Generator[bytes, None, None]:
errors = []
try:
for f in self.fgen:
if "err" in f:
errors.append((f["vp"], f["err"]))
@ -280,6 +281,8 @@ class StreamZip(StreamArc):
try:
for x in self.ser(f):
yield x
except GeneratorExit:
raise
except:
ex = min_ex(5, True).replace("\n", "\n-- ")
errors.append((f["vp"], ex))
@ -307,6 +310,6 @@ class StreamZip(StreamArc):
ecdr, _ = gen_ecdr(self.items, cdir_pos, cdir_end)
yield self._ct(ecdr)
finally:
if errors:
bos.unlink(errf["ap"])