diff --git a/bench/cli.py b/bench/cli.py index fd419d00..21c8701b 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -1,6 +1,6 @@ import click import os, sys, logging, json, pwd, subprocess -from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe +from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe, log from bench.app import get_apps from bench.config.common_site_config import get_config from bench.commands import bench_command @@ -43,7 +43,7 @@ def cli(): def check_uid(): if cmd_requires_root() and not is_root(): - print('superuser privileges required for this command') + log('superuser privileges required for this command', level=3) sys.exit(1) def cmd_requires_root(): @@ -71,7 +71,7 @@ def change_uid(): drop_privileges(uid_name=frappe_user, gid_name=frappe_user) os.environ['HOME'] = pwd.getpwnam(frappe_user).pw_dir else: - print('You should not run this command as root') + log('You should not run this command as root', level=3) sys.exit(1) def old_frappe_cli(bench_path='.'): @@ -93,6 +93,7 @@ def get_frappe_commands(bench_path='.'): python = get_env_cmd('python', bench_path=bench_path) sites_path = os.path.join(bench_path, 'sites') if not os.path.exists(sites_path): + log("WARN: Command not being executed in bench directory", level=3) return [] try: output = get_cmd_output("{python} -m frappe.utils.bench_helper get-frappe-commands".format(python=python), cwd=sites_path)