mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 00:37:51 +00:00
fix: Show traceback on bench init failure
Other changes: * Invoke internal init function instead of invoking click command. This was done to avoid handling random Exceptions that are done in the command definition * os.chdir after initializing new bench in get_app
This commit is contained in:
parent
a192240cec
commit
30e3e725a8
@ -276,10 +276,11 @@ def get_app(
|
|||||||
branch = app.tag
|
branch = app.tag
|
||||||
|
|
||||||
if not is_bench_directory(bench_path):
|
if not is_bench_directory(bench_path):
|
||||||
bench_path = generate_bench_name(git_url, bench_path)
|
from bench.utils.system import init
|
||||||
from bench.commands.make import init
|
|
||||||
|
|
||||||
click.get_current_context().invoke(init, path=bench_path, frappe_branch=branch)
|
bench_path = get_available_folder_name(f"{app.repo}-bench", bench_path)
|
||||||
|
init(path=bench_path, frappe_branch=branch)
|
||||||
|
os.chdir(bench_path)
|
||||||
|
|
||||||
cloned_path = os.path.join(bench_path, "apps", repo_name)
|
cloned_path = os.path.join(bench_path, "apps", repo_name)
|
||||||
dir_already_exists = os.path.isdir(cloned_path)
|
dir_already_exists = os.path.isdir(cloned_path)
|
||||||
|
@ -44,10 +44,11 @@ def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups, c
|
|||||||
except SystemExit:
|
except SystemExit:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import os, shutil, time
|
import shutil, time
|
||||||
|
from bench.utils import get_traceback
|
||||||
# add a sleep here so that the traceback of other processes doesnt overlap with the prompts
|
# add a sleep here so that the traceback of other processes doesnt overlap with the prompts
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print(e)
|
print(get_traceback())
|
||||||
log(f"There was a problem while creating {path}", level=2)
|
log(f"There was a problem while creating {path}", level=2)
|
||||||
if click.confirm("Do you want to rollback these changes?"):
|
if click.confirm("Do you want to rollback these changes?"):
|
||||||
print(f'Rolling back Bench "{path}"')
|
print(f'Rolling back Bench "{path}"')
|
||||||
|
Loading…
Reference in New Issue
Block a user