Cleanup the code in gclient_utils to standardize on CheckCall nomenclature.
Simplify code by removing fail_status
Rename print_messages to always
Simplify the doc.
Review URL: http://codereview.chromium.org/3104036
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58201 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 778e52f..5ca7036 100644
--- a/gclient.py
+++ b/gclient.py
@@ -448,11 +448,15 @@
splice_index = command.index('$matching_files')
command[splice_index:splice_index + 1] = matching_file_list
- # Use a discrete exit status code of 2 to indicate that a hook action
- # failed. Users of this script may wish to treat hook action failures
- # differently from VC failures.
- return gclient_utils.SubprocessCall(command, cwd=self.root_dir(),
- fail_status=2)
+ try:
+ gclient_utils.CheckCallAndFilterAndHeader(
+ command, cwd=self.root_dir(), always=True)
+ except gclient_utils.Error, e:
+ # Use a discrete exit status code of 2 to indicate that a hook action
+ # failed. Users of this script may wish to treat hook action failures
+ # differently from VC failures.
+ print >> sys.stderr, 'Error: %s' % str(e)
+ sys.exit(2)
def root_dir(self):
return self.parent.root_dir()