From 79dd24809d7ead42117eb2a3c100b63874feb011 Mon Sep 17 00:00:00 2001 From: Fredrik Eriksson Date: Fri, 25 Oct 2019 19:57:50 +0200 Subject: [PATCH] execute subcommands in parent enviornment (resepect http_proxy and similar) --- sau/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sau/helpers.py b/sau/helpers.py index 6096abb..e1faf18 100644 --- a/sau/helpers.py +++ b/sau/helpers.py @@ -1,17 +1,21 @@ import logging +import os import subprocess import time import sau def exec_cmd(cmd, timeout=900, env = None): + my_env = os.environ.copy() + if env: + my_env.update(env) log = logging.getLogger(sau.LOGNAME) log.debug('Executing "{}"'.format(' '.join(cmd))) proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - env = env) + env = my_env) out = b"" err = b""