Fix Builder::execute() to more properly pass the desired environment
authorDavid Greene <greened@obbligato.org>
Tue, 22 Feb 2011 23:30:45 +0000 (23:30 +0000)
committerDavid Greene <greened@obbligato.org>
Tue, 22 Feb 2011 23:30:45 +0000 (23:30 +0000)
to tools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126263 91177308-0d34-0410-b5e6-96231b3b80d8

utils/llvmbuild

index 56a429f0396837a7f823ab8b0fa5ccfa3c703cc4..f20bb06dce10719f63094e93eeaef54a37d3fdca 100755 (executable)
@@ -318,8 +318,10 @@ class Builder(threading.Thread):
         if not os.path.exists(execdir):
             os.makedirs(execdir)
 
+        execenv = os.environ.copy()
+
         for key, value in env.items():
-            os.environ[key] = value
+            execenv[key] = value
  
         self.logger.debug("[" + prefix + "] " + "env " + str(env) + " "
                           + " ".join(command));
@@ -327,6 +329,7 @@ class Builder(threading.Thread):
         try:
             proc = subprocess.Popen(command,
                                     cwd=execdir,
+                                    env=execenv,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.STDOUT)
 
@@ -339,9 +342,6 @@ class Builder(threading.Thread):
         except:
             traceback.print_exc()
 
-        for key, value in env.items():
-            os.environ.pop(key)
-
     # Get a list of C++ include directories to pass to clang.
     def get_includes(self):
         # Assume we're building with g++ for now.