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

Unified Diff: gclient.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') | « gcl.py ('k') | git_auto_svn.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 5f9dac5c566e64f39de8d4b683809bbcab565e2a..41f9d5b3d3f17ff1fcb3283ba082dfb2d91e6fc9 100755
--- a/gclient.py
+++ b/gclient.py
@@ -2266,7 +2266,7 @@ def disable_buffering():
sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout)
-def Main(argv):
+def main(argv):
"""Doesn't parse the arguments here, just find the right subcommand to
execute."""
if sys.hexversion < 0x02060000:
@@ -2292,9 +2292,14 @@ def Main(argv):
return 1
finally:
gclient_utils.PrintWarnings()
+ return 0
if '__main__' == __name__:
- sys.exit(Main(sys.argv[1:]))
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)
# vim: ts=2:sw=2:tw=80:et:
« clang_format.py ('K') | « gcl.py ('k') | git_auto_svn.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698