mirror of https://github.com/CIRCL/lookyloo
chg: Always make sure the lock file is removed even if building the tree fails
parent
7f221c8b9e
commit
17af2df5cd
|
@ -194,16 +194,17 @@ class Lookyloo():
|
||||||
raise NoValidHarFile(e.message)
|
raise NoValidHarFile(e.message)
|
||||||
except RecursionError as e:
|
except RecursionError as e:
|
||||||
raise NoValidHarFile(f'Tree too deep, probably a recursive refresh: {e}.\n Append /export to the URL to get the files.')
|
raise NoValidHarFile(f'Tree too deep, probably a recursive refresh: {e}.\n Append /export to the URL to get the files.')
|
||||||
|
else:
|
||||||
with pickle_file.open('wb') as _p:
|
with pickle_file.open('wb') as _p:
|
||||||
# Some pickles require a pretty high recursion limit, this kindof fixes it.
|
# Some pickles require a pretty high recursion limit, this kindof fixes it.
|
||||||
# If the capture is really broken (generally a refresh to self), the capture
|
# If the capture is really broken (generally a refresh to self), the capture
|
||||||
# is discarded in the RecursionError above.
|
# is discarded in the RecursionError above.
|
||||||
default_recursion_limit = sys.getrecursionlimit()
|
default_recursion_limit = sys.getrecursionlimit()
|
||||||
sys.setrecursionlimit(int(default_recursion_limit * 1.1))
|
sys.setrecursionlimit(int(default_recursion_limit * 1.1))
|
||||||
pickle.dump(ct, _p)
|
pickle.dump(ct, _p)
|
||||||
sys.setrecursionlimit(default_recursion_limit)
|
sys.setrecursionlimit(default_recursion_limit)
|
||||||
lock_file.unlink(missing_ok=True)
|
finally:
|
||||||
|
lock_file.unlink(missing_ok=True)
|
||||||
return ct
|
return ct
|
||||||
|
|
||||||
def _build_cname_chain(self, known_cnames: Dict[str, Optional[str]], hostname) -> List[str]:
|
def _build_cname_chain(self, known_cnames: Dict[str, Optional[str]], hostname) -> List[str]:
|
||||||
|
|
Loading…
Reference in New Issue