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

Unified Diff: git_map_branches.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') | « git_map.py ('k') | git_mark_merge_base.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_map_branches.py
diff --git a/git_map_branches.py b/git_map_branches.py
index 44f13c3bd5abc010269e48d05d6d82a7374ddf65..0bf57499e738d0781da76551f75363dbe46d1fed 100755
--- a/git_map_branches.py
+++ b/git_map_branches.py
@@ -266,13 +266,18 @@ def main(argv):
parser.add_argument('--no-color', action='store_true', dest='nocolor',
help='Turn off colors.')
- opts = parser.parse_args(argv[1:])
+ opts = parser.parse_args(argv)
mapper = BranchMapper()
mapper.verbosity = opts.v
mapper.output.nocolor = opts.nocolor
mapper.start()
print mapper.output.as_formatted_string()
+ return 0
if __name__ == '__main__':
- sys.exit(main(sys.argv))
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)
« clang_format.py ('K') | « git_map.py ('k') | git_mark_merge_base.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698