You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/05/08 23:16:30 UTC

git commit: Updated post-reviews to catch exceptions and return None if ignoring errors in execute.

Repository: mesos
Updated Branches:
  refs/heads/master 02e6fa98a -> a99fc8098


Updated post-reviews to catch exceptions and return None if ignoring
errors in execute.

Review: https://reviews.apache.org/r/21086


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a99fc809
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a99fc809
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a99fc809

Branch: refs/heads/master
Commit: a99fc8098621e34a19c4e73e9da1011d32c737cc
Parents: 02e6fa9
Author: Dominic Hamon <dh...@twopensource.com>
Authored: Thu May 8 14:15:16 2014 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Thu May 8 14:15:16 2014 -0700

----------------------------------------------------------------------
 support/post-reviews.py | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a99fc809/support/post-reviews.py
----------------------------------------------------------------------
diff --git a/support/post-reviews.py b/support/post-reviews.py
index c0066bd..2d5447b 100755
--- a/support/post-reviews.py
+++ b/support/post-reviews.py
@@ -37,11 +37,18 @@ def readline(prompt):
 
 
 def execute(command, ignore_errors=False):
-    process = Popen(command,
-                    stdin=PIPE,
-                    stdout=PIPE,
-                    stderr=STDOUT,
-                    shell=False)
+    process = None
+    try:
+        process = Popen(command,
+                stdin=PIPE,
+                stdout=PIPE,
+                stderr=STDOUT,
+                shell=False)
+    except:
+        if not ignore_errors:
+            raise
+        return None
+
     data = process.stdout.read()
     status = process.wait()
     if status != 0 and not ignore_errors:
@@ -58,9 +65,9 @@ def execute(command, ignore_errors=False):
 
 # Choose 'post-review' if available, otherwise choose 'rbt'.
 post_review = None
-if execute(['type', 'post-review'], ignore_errors=True):
+if execute(['post-review', '--version'], ignore_errors=True):
   post_review = ['post-review']
-elif execute(['type', 'rbt'], ignore_errors=True):
+elif execute('rbt', '--version', ignore_errors=True):
   post_review = ['rbt', 'post']
 else:
   print 'Please install RBTools before proceeding'