Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions scripts/ebcli_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'py': """#!/usr/bin/env python
import subprocess
import sys
import os


def _exec_cmd(args):
Expand All @@ -92,7 +93,7 @@ def _exec_cmd(args):
the return code of the subprocess to remain None. In all such cases, the
wrapper will assume a failure and return a non-zero exit code.
\"\"\"
p = subprocess.Popen(args)
p = subprocess.Popen(args, env=dict(PATH=os.environ['PATH'])) # run it in the virtual env that this script activated
try:
p.communicate()
except KeyboardInterrupt:
Expand Down Expand Up @@ -664,6 +665,8 @@ def _exec_cmd(args, quiet):
"""
Function invokes `subprocess.Popen` in the `shell=True` mode and returns
the return code of the subprocess.
It ensures that the commands are run in the virtualenv activated by
`_activate_virtualenv`.

:param args: the args to pass to `subprocess.Popen`
:param quiet: Whether to avoid displaying output of the subprocess to
Expand All @@ -675,7 +678,8 @@ def _exec_cmd(args, quiet):
' '.join(args),
stdout=stdout,
stderr=stdout,
shell=True
shell=True,
env={'PATH': os.environ['PATH']} # run it in the virtual env that this script activated
)

p.communicate()
Expand Down