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.

On Fri, Apr 17, 2015 at 4:29 PM Jose Ricardo Ziviani <> wrote:
 - 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 <>
 src/kimchi/ | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/ b/src/kimchi/
index d71338a..2017cbe 100644
--- a/src/kimchi/
+++ b/src/kimchi/
@@ -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):

         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])

Kimchi-devel mailing list