Updated to the latest version of upload.py
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 06 Dec 2008 19:25:01 +0000
changeset 687 4755caf1d7a6
parent 686 df109be0567c
child 688 125cad9596da
Updated to the latest version of upload.py Patch by: Sverre Rabbelier
thirdparty/rietveld/upload.py
--- a/thirdparty/rietveld/upload.py	Sat Dec 06 16:52:21 2008 +0000
+++ b/thirdparty/rietveld/upload.py	Sat Dec 06 19:25:01 2008 +0000
@@ -151,7 +151,6 @@
     Returns:
       The authentication token returned by ClientLogin.
     """
-    # account_type = "GOOGLE"
     account_type = "HOSTED_OR_GOOGLE"
     if self.host.endswith(".google.com"):
       # Needed for use inside Google.
@@ -510,19 +509,20 @@
 
 def RunShellWithReturnCode(command, print_output=False,
                            universal_newlines=True):
-  """Executes a command and returns the output and the return code.
+  """Executes a command and returns the output from stdout and the return code.
 
   Args:
     command: Command to execute.
     print_output: If True, the output is printed to stdout.
+                  If False, both stdout and stderr are ignored.
     universal_newlines: Use universal_newlines flag (default: True).
 
   Returns:
     Tuple (output, return code)
   """
   logging.info("Running %s", command)
-  p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=use_shell,
-                       universal_newlines=universal_newlines)
+  p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                       shell=use_shell, universal_newlines=universal_newlines)
   if print_output:
     output_array = []
     while True:
@@ -535,7 +535,11 @@
   else:
     output = p.stdout.read()
   p.wait()
+  errout = p.stderr.read()
+  if print_output and errout:
+    print >>sys.stderr, errout
   p.stdout.close()
+  p.stderr.close()
   return output, p.returncode