execute subcommands in parent enviornment (resepect http_proxy and
similar)
This commit is contained in:
parent
04cbedb9c0
commit
79dd24809d
@ -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""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user