summaryrefslogtreecommitdiffstats
path: root/qa/shell.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-11-03 06:07:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-11-03 06:07:45 +0000
commit5f208e04c159791e668031a7fa83f98724ec8d24 (patch)
tree4b58b42fd2a91a14871010e2dd39369a839ae383 /qa/shell.py
parentAdding upstream version 0.13.1. (diff)
downloadgitlint-5f208e04c159791e668031a7fa83f98724ec8d24.tar.xz
gitlint-5f208e04c159791e668031a7fa83f98724ec8d24.zip
Adding upstream version 0.14.0.upstream/0.14.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/shell.py')
-rw-r--r--qa/shell.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/qa/shell.py b/qa/shell.py
index 8ba6dc1..43e5bbd 100644
--- a/qa/shell.py
+++ b/qa/shell.py
@@ -3,8 +3,7 @@
# on gitlint internals for our integration testing framework.
import subprocess
-import sys
-from qa.utils import ustr, USE_SH_LIB
+from qa.utils import ustr, USE_SH_LIB, IS_PY2
if USE_SH_LIB:
from sh import git, echo, gitlint # pylint: disable=unused-import,no-name-in-module,import-error
@@ -59,7 +58,7 @@ else:
return ustr(result)
def _exec(*args, **kwargs):
- if sys.version_info[0] == 2:
+ if IS_PY2:
no_command_error = OSError # noqa pylint: disable=undefined-variable,invalid-name
else:
no_command_error = FileNotFoundError # noqa pylint: disable=undefined-variable
@@ -68,6 +67,8 @@ else:
popen_kwargs = {'stdout': pipe, 'stderr': pipe, 'shell': kwargs.get('_tty_out', False)}
if '_cwd' in kwargs:
popen_kwargs['cwd'] = kwargs['_cwd']
+ if '_env' in kwargs:
+ popen_kwargs['env'] = kwargs['_env']
try:
p = subprocess.Popen(args, **popen_kwargs)