Use subprocess.Popen, hoping for Windows portability
authorDavid Neto <dneto@google.com>
Tue, 23 Feb 2016 22:58:31 +0000 (17:58 -0500)
committerDavid Neto <dneto@google.com>
Tue, 23 Feb 2016 23:09:50 +0000 (18:09 -0500)
Replaces use of subprocess.check_output

utils/update_build_version.py

index 0a62488..13efc26 100755 (executable)
@@ -34,8 +34,10 @@ def describe(dir):
     """Runs 'git describe' in dir.  If successful, returns the output; otherwise,
 returns 'unknown hash, <date>'."""
     try:
-        return subprocess.check_output(["git", "describe"], cwd=dir).rstrip()
-    except subprocess.CalledProcessError:
+        p = subprocess.Popen(["git", "describe"], stdout=subprocess.PIPE, cwd=dir)
+        (stdout, _) = p.communicate()
+        return stdout.rstrip()
+    except:
         return 'unknown hash, ' + datetime.date.today().isoformat()
 
 def main():