chiark / gitweb /
init: make prompt for SDK path exit cleanly on Ctrl-C
authorHans-Christoph Steiner <hans@eds.org>
Fri, 30 May 2014 15:41:02 +0000 (11:41 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 5 Jun 2014 01:54:55 +0000 (21:54 -0400)
This just makes a clean exit rather than showing a python stacktrace.

fdroidserver/init.py

index c51b6e59bdd7af75262183706f7ee2b93461d97f..f55549ab4bb73591e47b65cbe8588201dc66917a 100644 (file)
@@ -132,7 +132,12 @@ def main():
         # if neither --android-home nor the default sdk_path exist, prompt the user
         default_sdk_path = '/opt/android-sdk'
         while not options.no_prompt:
-            s = raw_input('Enter the path to the Android SDK (' + default_sdk_path + ') here:\n> ')
+            try:
+                s = raw_input('Enter the path to the Android SDK ('
+                              + default_sdk_path + ') here:\n> ')
+            except KeyboardInterrupt:
+                print('')
+                sys.exit(1)
             if re.match('^\s*$', s) is not None:
                 test_config['sdk_path'] = default_sdk_path
             else: