From bad6cda2eb64cda082bed518f5115dd8c10c86f3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 15 Feb 2020 09:10:52 -0600 Subject: [PATCH] ceph.in: catch KeyboardInterrupt from outer code This avoids getting random tracebacks when you control-C early in the process. Signed-off-by: Sage Weil --- src/ceph.in | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index 9b9012e718514..757551754531c 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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) -- 2.39.5