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

Unified Diff: git_map.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_freezer.py ('k') | git_map_branches.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_map.py
diff --git a/git_map.py b/git_map.py
index 65814b9f337becee3d85e697b7ab574ba9ee8fb9..99c8b05c7513344da8361d710a68bf53ae420455 100755
--- a/git_map.py
+++ b/git_map.py
@@ -37,13 +37,13 @@ RESET = colorama.Fore.RESET + colorama.Back.RESET + colorama.Style.RESET_ALL
# Git emits combined color
BRIGHT_RED = '\x1b[1;31m'
-def main():
+def main(argv):
map_extra = config_list('depot_tools.map_extra')
fmt = '%C(red bold)%h%x09%Creset%C(green)%d%Creset %C(yellow)%ad%Creset ~ %s'
log_proc = subprocess2.Popen(
[GIT_EXE, 'log', '--graph', '--branches', '--tags', root(),
'--color=always', '--date=short', ('--pretty=format:' + fmt)
- ] + map_extra + sys.argv[1:],
+ ] + map_extra + argv,
stdout=subprocess2.PIPE,
shell=False)
@@ -110,5 +110,8 @@ def main():
if __name__ == '__main__':
- sys.exit(main())
-
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)
« clang_format.py ('K') | « git_freezer.py ('k') | git_map_branches.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698