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

Unified Diff: presubmit_support.py

Issue 955993006: Handle KeyboardInterrupt consistently in python scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: tweek test expectations Created 5 years, 10 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
« clang_format.py ('K') | « my_reviews.py ('k') | pylint.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index b386524068c1ceddc44fc4e10edc4c596d6f577c..81d34828a53558405d90807eae2deeba069c9e77 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -1531,7 +1531,7 @@ def CallCommand(cmd_data):
return cmd_data.info('%s (%4.2fs)' % (cmd_data.name, duration))
-def Main(argv):
+def main(argv=None):
parser = optparse.OptionParser(usage="%prog [options] <files...>",
version="%prog " + str(__version__))
parser.add_option("-c", "--commit", action="store_true", default=False,
@@ -1675,4 +1675,8 @@ def Main(argv):
if __name__ == '__main__':
fix_encoding.fix_encoding()
- sys.exit(Main(None))
+ try:
+ sys.exit(main())
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)
« clang_format.py ('K') | « my_reviews.py ('k') | pylint.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698