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 logging
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import sau
|
import sau
|
||||||
|
|
||||||
def exec_cmd(cmd, timeout=900, env = None):
|
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 = logging.getLogger(sau.LOGNAME)
|
||||||
log.debug('Executing "{}"'.format(' '.join(cmd)))
|
log.debug('Executing "{}"'.format(' '.join(cmd)))
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
cmd,
|
cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env = env)
|
env = my_env)
|
||||||
out = b""
|
out = b""
|
||||||
err = b""
|
err = b""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user