Wrap raw_input() around a try/except to reduce the number of false-positive in breakpad

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6706007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80182 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 53258c6..e7569e2 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -43,6 +43,7 @@
 POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s'
 DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup'
 
+
 def DieWithError(message):
   print >> sys.stderr, message
   sys.exit(1)
@@ -98,6 +99,14 @@
   return hook
 
 
+def ask_for_data(prompt):
+  try:
+    return raw_input(prompt)
+  except KeyboardInterrupt:
+    # Hide the exception.
+    sys.exit(1)
+
+
 def FixUrl(server):
   """Fix a server url to defaults protocol to http:// if none is specified."""
   if not server:
@@ -526,7 +535,7 @@
   server = settings.GetDefaultServerUrl(error_ok=True)
   prompt = 'Rietveld server (host[:port])'
   prompt += ' [%s]' % (server or DEFAULT_SERVER)
-  newserver = raw_input(prompt + ': ')
+  newserver = ask_for_data(prompt + ':')
   if not server and not newserver:
     newserver = DEFAULT_SERVER
   if newserver and newserver != server:
@@ -536,7 +545,7 @@
     prompt = caption
     if initial:
       prompt += ' ("x" to clear) [%s]' % initial
-    new_val = raw_input(prompt + ': ')
+    new_val = ask_for_data(prompt + ':')
     if new_val == 'x':
       RunGit(['config', '--unset-all', 'rietveld.' + name], error_ok=True)
     elif new_val and new_val != initial:
@@ -1113,7 +1122,7 @@
   branches = [base_branch, cl.GetBranchRef()]
   if not options.force:
     subprocess.call(['git', 'diff', '--stat'] + branches)
-    raw_input("About to commit; enter to confirm.")
+    ask_for_data('About to commit; enter to confirm.')
 
   # We want to squash all this branch's commits into one commit with the
   # proper description.
@@ -1198,7 +1207,7 @@
 Choose wisely, if you get this wrong, your commit might appear to succeed but
 will instead be silently ignored."""
     print(message)
-    raw_input('[Press enter to dcommit or ctrl-C to quit]')
+    ask_for_data('[Press enter to dcommit or ctrl-C to quit]')
   return SendUpstream(parser, args, 'dcommit')
 
 
@@ -1208,7 +1217,7 @@
   if settings.GetIsGitSvn():
     print('This appears to be an SVN repository.')
     print('Are you sure you didn\'t mean \'git cl dcommit\'?')
-    raw_input('[Press enter to push or ctrl-C to quit]')
+    ask_for_data('[Press enter to push or ctrl-C to quit]')
   return SendUpstream(parser, args, 'push')