Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Unified Diff: tools/metrics/common/presubmit_util.py

Issue 1019123003: [Metrics] Fix presubmit scripts to return an error code on failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually set the exit code Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/common/presubmit_util.py
diff --git a/tools/metrics/common/presubmit_util.py b/tools/metrics/common/presubmit_util.py
index fc05d15f9198cfbf5cbfb8b0916c2a699af4f58d..ba87d3a1a9c354baa62e7595aea60b6285d77a57 100644
--- a/tools/metrics/common/presubmit_util.py
+++ b/tools/metrics/common/presubmit_util.py
@@ -47,27 +47,27 @@ def DoPresubmitMain(argv, original_filename, backup_filename, script_name,
if '\r' in original_xml:
logging.error('DOS-style line endings (CR characters) detected - these are '
'not allowed. Please run dos2unix %s', original_filename)
- return 1
+ sys.exit(1)
try:
pretty = prettyFn(original_xml)
except Error:
logging.error('Aborting parsing due to fatal errors.')
- return 1
+ sys.exit(1)
if original_xml == pretty:
logging.info('%s is correctly pretty-printed.', original_filename)
- return 0
+ sys.exit(0)
if presubmit:
logging.error('%s is not formatted correctly; run %s to fix.',
original_filename, script_name)
- return 1
+ sys.exit(1)
# Prompt user to consent on the change.
if not diff_util.PromptUserToAcceptDiff(
original_xml, pretty, 'Is the new version acceptable?'):
logging.error('Diff not accepted. Aborting.')
- return 1
+ sys.exit(1)
logging.info('Creating backup file: %s', backup_filename)
shutil.move(xml_path, os.path.join(xml_dir, backup_filename))
@@ -76,4 +76,4 @@ def DoPresubmitMain(argv, original_filename, backup_filename, script_name,
f.write(pretty)
logging.info('Updated %s. Don\'t forget to add it to your changelist',
xml_path)
- return 0
+ sys.exit(0)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698