Skip to content

Commit a33728b

Browse files
Xavier-Dod-fence
authored andcommitted
[FIX] runbot: don't break loop if rmtree fails
1 parent 41166c3 commit a33728b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

runbot/models/build.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,18 @@ def filter_ids(dest_list, label):
645645
gcstamp = build_dir / '.gcstamp'
646646
for bdir_file in build_dir.iterdir():
647647
if bdir_file.is_dir() and bdir_file.name not in ('logs', 'tests'):
648-
shutil.rmtree(bdir_file)
648+
try:
649+
shutil.rmtree(bdir_file)
650+
except Exception:
651+
_logger.exception('Failed to remove %s', bdir_file)
649652
elif bdir_file.name == 'logs':
650653
for log_file_path in bdir_file.iterdir():
651654
if log_file_path.is_dir():
652-
shutil.rmtree(log_file_path)
655+
656+
try:
657+
shutil.rmtree(log_file_path)
658+
except Exception:
659+
_logger.exception('Failed to remove %s', log_file_path)
653660
elif log_file_path.name in ('run.txt', 'wake_up.txt') or not log_file_path.name.endswith('.txt'):
654661
log_file_path.unlink()
655662
gcstamp.write_text(f'gc date: {datetime.datetime.now()}')

0 commit comments

Comments
 (0)