Skip to content

Commit e41d157

Browse files
authored
Pass environment on to subprocess and support running behing a proxy (#572)
Support use-cases like running behind a proxy by passing the environment on to subprocesses.
1 parent f071fd7 commit e41d157

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

aws_gate/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ def deferred_signals(signal_list=None):
125125
def execute(cmd, args, **kwargs):
126126
ret, result = None, None
127127

128-
env = DEFAULT_GATE_BIN_PATH + os.pathsep + os.environ["PATH"]
129-
128+
env_path = DEFAULT_GATE_BIN_PATH + os.pathsep + os.environ["PATH"]
129+
env = os.environ.copy().update({"PATH": env_path})
130130
try:
131131
logger.debug('Executing "%s"', " ".join([cmd] + args))
132-
result = subprocess.run([cmd] + args, env={"PATH": env}, check=True, **kwargs)
132+
result = subprocess.run([cmd] + args, env=env, check=True, **kwargs)
133133
except subprocess.CalledProcessError as e:
134134
logger.error(
135135
'Command "%s" exited with %s', " ".join([cmd] + args), e.returncode

0 commit comments

Comments
 (0)