From ac96188f2d252c1941198b7fc868edaf8446b75a Mon Sep 17 00:00:00 2001 From: nonylene Date: Thu, 20 Apr 2017 01:47:38 +0900 Subject: [PATCH] Use subprocess on Windows os.execl has strange behavior on Windows. --- pipenv/cli.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 2fb415f9..3da5938f 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -992,18 +992,18 @@ def run(command, args, three=None, python=False): command_path = which(command) - try: - c = os.execl(command_path, command_path, *args) - except FileNotFoundError: + if not os.path.exists(command_path): click.echo(crayons.red('The command ({0}) was not found within the virtualenv!'.format(command_path))) sys.exit(1) - # Windows! - except AttributeError: + if os.name == 'nt': + # Windows! import subprocess p = subprocess.Popen([command_path] + list(args), shell=True, universal_newlines=True) p.communicate() sys.exit(p.returncode) + else: + os.execl(command_path, command_path, *args) @click.command(help="Checks PEP 508 markers provided in Pipfile.")