mirror of
https://github.com/frappe/bench.git
synced 2025-01-04 22:55:25 +00:00
fix: wrap tarfile with error handling
- ensure return to cwd after tarring
This commit is contained in:
parent
0e2e8b4da3
commit
30f301e3ff
16
bench/app.py
16
bench/app.py
@ -365,11 +365,19 @@ class App(AppMeta):
|
||||
click.secho(message)
|
||||
|
||||
self.prune_app_directory()
|
||||
|
||||
success = False
|
||||
os.chdir(app_path.parent)
|
||||
with tarfile.open(cache_path, mode) as tar:
|
||||
tar.add(app_path.name)
|
||||
os.chdir(cwd)
|
||||
return True
|
||||
try:
|
||||
with tarfile.open(cache_path, mode) as tar:
|
||||
tar.add(app_path.name)
|
||||
success = True
|
||||
except Exception:
|
||||
log(f"Failed to cache {app_path}", level=3)
|
||||
success = False
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
return success
|
||||
|
||||
def prune_app_directory(self):
|
||||
app_path = self.get_app_path()
|
||||
|
Loading…
Reference in New Issue
Block a user