diff --git a/bench/cli.py b/bench/cli.py index 215d47cd1..d7a9b4cc4 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -132,10 +132,7 @@ def cli(): bench_command() if in_bench: - if cmd_from_sys in get_frappe_commands(): - frappe_cmd() - else: - app_cmd() + frappe_cmd() bench_command() diff --git a/bench/utils/bench.py b/bench/utils/bench.py index 701e37804..9eba296a7 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -32,8 +32,13 @@ @lru_cache(maxsize=None) def get_env_cmd(cmd: str, bench_path: str = ".") -> str: - # this supports envs' generated by patched virtualenv or venv (which may cause an extra 'local' folder to be created) + exact_location = os.path.abspath( + os.path.join(bench_path, "env", "bin", cmd.strip("*")) + ) + if os.path.exists(exact_location): + return exact_location + # this supports envs' generated by patched virtualenv or venv (which may cause an extra 'local' folder to be created) existing_python_bins = glob( os.path.join(bench_path, "env", "**", "bin", cmd), recursive=True ) @@ -41,8 +46,7 @@ def get_env_cmd(cmd: str, bench_path: str = ".") -> str: if existing_python_bins: return os.path.abspath(existing_python_bins[0]) - cmd = cmd.strip("*") - return os.path.abspath(os.path.join(bench_path, "env", "bin", cmd)) + return exact_location def get_venv_path(verbose=False, python="python3"):