diff options
| author | jvoisin | 2019-10-17 22:49:57 +0200 |
|---|---|---|
| committer | jvoisin | 2019-10-17 22:51:00 +0200 |
| commit | a389cc760aebc621bfc4016f6393d0ce2381d2d1 (patch) | |
| tree | 523cef8f2cac838f7ff64a352436d56804977e42 | |
| parent | 4034cf9a1af52cb26ec551cea6af90683677e132 (diff) | |
Fix a stacktrace in ./mat2 when the file can't be cleaned
| -rwxr-xr-x | mat2 | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -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)) |
