fix: Properly remove files if the scraping failed

pull/42/head
Raphaël Vinot 2019-04-04 00:41:15 +02:00
parent 346f2d6ec3
commit 0d937b02c9
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ class Lookyloo():
har_files = sorted(report_dir.glob('*.har'))
if not har_files:
self.logger.warning(f'No har files in {report_dir}')
if (report_dir / 'uuid').exists():
(report_dir / 'uuid').unlink()
if (report_dir / 'no_index').exists():
(report_dir / 'no_index').unlink()
report_dir.rmdir()
return
with (report_dir / 'uuid').open() as f: