mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
[fix] don't use async if invoked from command line
This commit is contained in:
parent
9065066b8f
commit
05b8d22f44
@ -63,9 +63,9 @@ def new_app(app, bench='.'):
|
||||
apps = os.path.abspath(os.path.join(bench, 'apps'))
|
||||
if FRAPPE_VERSION == 4:
|
||||
exec_cmd("{frappe} --make_app {apps} {app}".format(frappe=get_frappe(bench=bench),
|
||||
apps=apps, app=app), async=False)
|
||||
apps=apps, app=app))
|
||||
else:
|
||||
run_frappe_cmd('make-app', apps, app, bench=bench, async=False)
|
||||
run_frappe_cmd('make-app', apps, app, bench=bench)
|
||||
install_app(app, bench=bench)
|
||||
|
||||
def install_app(app, bench='.'):
|
||||
|
@ -31,10 +31,14 @@ import grp
|
||||
import subprocess
|
||||
|
||||
logger = logging.getLogger('bench')
|
||||
from_command_line = False
|
||||
|
||||
global FRAPPE_VERSION
|
||||
|
||||
def cli():
|
||||
global from_command_line
|
||||
from_command_line = True
|
||||
|
||||
check_uid()
|
||||
change_dir()
|
||||
change_uid()
|
||||
|
@ -83,7 +83,10 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||
generate_redis_cache_config(bench=path)
|
||||
generate_redis_async_broker_config(bench=path)
|
||||
|
||||
def exec_cmd(cmd, cwd='.', async=True):
|
||||
def exec_cmd(cmd, cwd='.'):
|
||||
from .cli import from_command_line
|
||||
|
||||
async = False if from_command_line else True
|
||||
if async:
|
||||
stderr = stdout = subprocess.PIPE
|
||||
else:
|
||||
@ -462,11 +465,14 @@ def get_current_frappe_version(bench='.'):
|
||||
return fv(bench=bench)
|
||||
|
||||
def run_frappe_cmd(*args, **kwargs):
|
||||
from .cli import from_command_line
|
||||
|
||||
bench = kwargs.get('bench', '.')
|
||||
f = get_env_cmd('python', bench=bench)
|
||||
sites_dir = os.path.join(bench, 'sites')
|
||||
|
||||
if kwargs.get('async'):
|
||||
async = False if from_command_line else True
|
||||
if async:
|
||||
stderr = stdout = subprocess.PIPE
|
||||
else:
|
||||
stderr = stdout = None
|
||||
@ -474,7 +480,7 @@ def run_frappe_cmd(*args, **kwargs):
|
||||
p = subprocess.Popen((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args,
|
||||
cwd=sites_dir, stdout=stdout, stderr=stderr)
|
||||
|
||||
if kwargs.get('async'):
|
||||
if async:
|
||||
return_code = print_output(p)
|
||||
else:
|
||||
return_code = p.wait()
|
||||
|
Loading…
Reference in New Issue
Block a user