<div dir="ltr">The patch looks nice, but could you provide us a scenario where this patch is needed? In which situation are you trying to run a command and you need to specify a different set of environment variables other than the default ones (i.e. the env inherited by the main process)? I couldn't figure this out by reading the patch's description.<br><br><div class="gmail_quote">On Fri, Apr 17, 2015 at 4:29 PM Jose Ricardo Ziviani <<a href="mailto:joserz@linux.vnet.ibm.com" target="_blank">joserz@linux.vnet.ibm.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> - The called may want to pass a custom environment variable to<br>
run_command and now this is possible with this new parameter.<br>
<br>
Signed-off-by: Jose Ricardo Ziviani <<a href="mailto:joserz@linux.vnet.ibm.com" target="_blank">joserz@linux.vnet.ibm.com</a>><br>
---<br>
src/kimchi/utils.py | 6 ++++--<br>
1 file changed, 4 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py<br>
index d71338a..2017cbe 100644<br>
--- a/src/kimchi/utils.py<br>
+++ b/src/kimchi/utils.py<br>
@@ -165,11 +165,12 @@ def check_url_path(path):<br>
return True<br>
<br>
<br>
-def run_command(cmd, timeout=None):<br>
+def run_command(cmd, timeout=None, env=None):<br>
"""<br>
cmd is a sequence of command arguments.<br>
timeout is a float number in seconds.<br>
timeout default value is None, means command run without timeout.<br>
+ env is the environment variable passed to the command.<br>
"""<br>
# subprocess.kill() can leave descendants running<br>
# and halting the execution. Using psutil to<br>
@@ -193,7 +194,8 @@ def run_command(cmd, timeout=None):<br>
<br>
try:<br>
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,<br>
- stderr=subprocess.PIPE)<br>
+ stderr=subprocess.PIPE,<br>
+ env=env)<br>
if timeout is not None:<br>
timer = Timer(timeout, kill_proc, [proc, timeout_flag])<br>
timer.setDaemon(True)<br>
--<br>
1.9.1<br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a href="mailto:Kimchi-devel@ovirt.org" target="_blank">Kimchi-devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel" target="_blank">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a><br>
</blockquote></div></div>