
- The called may want to pass a custom environment variable to run_command and now this is possible with this new parameter. Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- src/kimchi/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py index d71338a..2017cbe 100644 --- a/src/kimchi/utils.py +++ b/src/kimchi/utils.py @@ -165,11 +165,12 @@ def check_url_path(path): return True -def run_command(cmd, timeout=None): +def run_command(cmd, timeout=None, env=None): """ cmd is a sequence of command arguments. timeout is a float number in seconds. timeout default value is None, means command run without timeout. + env is the environment variable passed to the command. """ # subprocess.kill() can leave descendants running # and halting the execution. Using psutil to @@ -193,7 +194,8 @@ def run_command(cmd, timeout=None): try: proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + env=env) if timeout is not None: timer = Timer(timeout, kill_proc, [proc, timeout_flag]) timer.setDaemon(True) -- 1.9.1