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

Unified Diff: git_try.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
Index: git_try.py
diff --git a/git_try.py b/git_try.py
index 45a5217e6f2a5fdd665af049c7f57b867ca98228..f8f6d306a86c921032090ca45dbdc37780bd2dd9 100755
--- a/git_try.py
+++ b/git_try.py
@@ -41,8 +41,7 @@ def GetRietveldServerUrl():
return None
-if __name__ == '__main__':
- args = sys.argv[1:]
+def main(args):
patchset = GetRietveldPatchsetNumber()
if patchset:
args.extend([
@@ -68,3 +67,12 @@ if __name__ == '__main__':
except third_party.upload.ClientLoginError, e:
print('Got an exception while trying to log in to Rietveld.')
print(str(e))
+ return 0
+
+
+if __name__ == '__main__':
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except KeyboardInterrupt:
+ sys.stderr.write('interrupted\n')
+ sys.exit(1)
« clang_format.py ('K') | « git_squash_branch.py ('k') | git_upstream_diff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698