From 8d3a34d45e5097d9c3ff283dc6e0fbb2e40816b6 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 4 Feb 2018 14:12:06 -0500 Subject: [PATCH] cleanup refactor Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 07c14ce6..55152f1f 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -303,44 +303,8 @@ def shell(three=None, python=False, fancy=False, shell_args=None, anyway=False): @click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.") @click.option('--python', default=False, nargs=1, help="Specify which version of Python virtualenv should use.") def run(command, args, three=None, python=False): - # Ensure that virtualenv is available. - ensure_project(three=three, python=python, validate=False) - - load_dot_env() - - # Separate out things that were passed in as a string. - _c = list(command.split()) - command = _c.pop(0) - if _c: - args = list(args) - for __c in reversed(_c): - args.insert(0, __c) - - # Activate virtualenv under the current interpreter's environment - inline_activate_virtualenv() - - # Windows! - if os.name == 'nt': - import subprocess - p = subprocess.Popen([command] + list(args), shell=True, universal_newlines=True) - p.communicate() - sys.exit(p.returncode) - else: - command_path = system_which(command) - if not command_path: - click.echo( - '{0}: the command {1} could not be found within {2}.' - ''.format( - crayons.red('Error', bold=True), - crayons.red(command), - crayons.normal('PATH', bold=True) - ), err=True - ) - sys.exit(1) - - # Execute the command. - os.execl(command_path, command_path, *args) - pass + from . import core + core.do_run(command=command, args=args, three=three, python=python) @click.command(short_help="Checks for security vulnerabilities and against PEP 508 markers provided in Pipfile.", context_settings=dict(