mirror of
https://github.com/github/codeql-action.git
synced 2026-04-01 17:22:19 +00:00
python-setup: change env passing
This commit is contained in:
@@ -9,30 +9,20 @@ from typing import Optional
|
||||
import extractor_version
|
||||
|
||||
|
||||
def _check_call(command, extra_env=None):
|
||||
def _check_call(command, extra_env={}):
|
||||
print('+ {}'.format(' '.join(command)), flush=True)
|
||||
|
||||
# only pass `env` argument if we need to pass in an updated environment
|
||||
kwargs = {}
|
||||
if extra_env:
|
||||
new_env = os.environ.copy()
|
||||
new_env.update(extra_env)
|
||||
kwargs = {"env": new_env}
|
||||
|
||||
subprocess.check_call(command, stdin=subprocess.DEVNULL, **kwargs)
|
||||
env = os.environ.copy()
|
||||
env.update(extra_env)
|
||||
subprocess.check_call(command, stdin=subprocess.DEVNULL, env=env)
|
||||
|
||||
|
||||
def _check_output(command, extra_env=None):
|
||||
def _check_output(command, extra_env={}):
|
||||
print('+ {}'.format(' '.join(command)), flush=True)
|
||||
|
||||
# only pass `env` argument if we need to pass in an updated environment
|
||||
kwargs = {}
|
||||
if extra_env:
|
||||
new_env = os.environ.copy()
|
||||
new_env.update(extra_env)
|
||||
kwargs = {"env": new_env}
|
||||
|
||||
out = subprocess.check_output(command, stdin=subprocess.DEVNULL, **kwargs)
|
||||
env = os.environ.copy()
|
||||
env.update(extra_env)
|
||||
out = subprocess.check_output(command, stdin=subprocess.DEVNULL, env=env)
|
||||
print(out, flush=True)
|
||||
sys.stderr.flush()
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user