mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +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
|
||||
|
||||
if not is_bench_directory(bench_path):
|
||||
bench_path = generate_bench_name(git_url, bench_path)
|
||||
from bench.commands.make import init
|
||||
from bench.utils.system 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)
|
||||
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:
|
||||
raise
|
||||
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
|
||||
time.sleep(1)
|
||||
print(e)
|
||||
print(get_traceback())
|
||||
log(f"There was a problem while creating {path}", level=2)
|
||||
if click.confirm("Do you want to rollback these changes?"):
|
||||
print(f'Rolling back Bench "{path}"')
|
||||
|
Loading…
Reference in New Issue
Block a user