From 2459965ca8fc5fe9604e3036bc177bc4fa6fd27e Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 20 Apr 2023 20:40:09 +0000 Subject: [PATCH] u2cli: dont enter delete stage if something failed --- bin/up2k.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/up2k.py b/bin/up2k.py index 73874cab..2f02f347 100755 --- a/bin/up2k.py +++ b/bin/up2k.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 from __future__ import print_function, unicode_literals -S_VERSION = "1.5" -S_BUILD_DT = "2023-03-12" +S_VERSION = "1.6" +S_BUILD_DT = "2023-04-20" """ up2k.py: upload to copyparty @@ -653,6 +653,7 @@ class Ctl(object): return nfiles, nbytes def __init__(self, ar, stats=None): + self.ok = False self.ar = ar self.stats = stats or self._scan() if not self.stats: @@ -700,6 +701,8 @@ class Ctl(object): self._fancy() + self.ok = True + def _safe(self): """minimal basic slow boring fallback codepath""" search = self.ar.s @@ -1131,11 +1134,13 @@ source file/folder selection uses rsync syntax, meaning that: ctl = Ctl(ar) - if ar.dr and not ar.drd: + if ar.dr and not ar.drd and ctl.ok: print("\npass 2/2: delete") ar.drd = True ar.z = True - Ctl(ar, ctl.stats) + ctl = Ctl(ar, ctl.stats) + + sys.exit(0 if ctl.ok else 1) if __name__ == "__main__":