]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: catch KeyboardInterrupt from outer code 33352/head
authorSage Weil <sage@redhat.com>
Sat, 15 Feb 2020 15:10:52 +0000 (09:10 -0600)
committerSage Weil <sage@redhat.com>
Wed, 19 Feb 2020 17:04:55 +0000 (11:04 -0600)
This avoids getting random tracebacks when you control-C early in the
process.

Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph.in

index 9b9012e7185149088114a5051b5a59e1bffe0a2e..757551754531cb4fb45c4435b99c65216bcb9b90 100755 (executable)
@@ -1267,8 +1267,13 @@ def main():
     return 0
 
 if __name__ == '__main__':
-    retval = main()
-    # shutdown explicitly; Rados() does not
-    if cluster_handle:
-        run_in_thread(cluster_handle.shutdown)
-    sys.exit(retval)
+    try:
+        retval = main()
+    except KeyboardInterrupt:
+        print('Interrupted')
+        retval = errno.EINTR
+    finally:
+        # shutdown explicitly; Rados() does not
+        if cluster_handle:
+            run_in_thread(cluster_handle.shutdown)
+        sys.exit(retval)