summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2019-10-17 22:49:57 +0200
committerjvoisin2019-10-17 22:51:00 +0200
commita389cc760aebc621bfc4016f6393d0ce2381d2d1 (patch)
tree523cef8f2cac838f7ff64a352436d56804977e42
parent4034cf9a1af52cb26ec551cea6af90683677e132 (diff)
Fix a stacktrace in ./mat2 when the file can't be cleaned
-rwxr-xr-xmat27
1 files changed, 4 insertions, 3 deletions
diff --git a/mat2 b/mat2
index 01b834b..ec09637 100755
--- a/mat2
+++ b/mat2
@@ -137,9 +137,10 @@ def clean_meta(filename: str, is_lightweight: bool, inplace: bool, sandbox: bool
137 try: 137 try:
138 logging.debug('Cleaning %s…', filename) 138 logging.debug('Cleaning %s…', filename)
139 ret = p.remove_all() 139 ret = p.remove_all()
140 shutil.copymode(filename, p.output_filename) 140 if ret is True:
141 if inplace is True: 141 shutil.copymode(filename, p.output_filename)
142 os.rename(p.output_filename, filename) 142 if inplace is True:
143 os.rename(p.output_filename, filename)
143 return ret 144 return ret
144 except RuntimeError as e: 145 except RuntimeError as e:
145 print("[-] %s can't be cleaned: %s" % (filename, e)) 146 print("[-] %s can't be cleaned: %s" % (filename, e))