From: Sage Weil Date: Sat, 15 Feb 2020 15:10:52 +0000 (-0600) Subject: ceph.in: catch KeyboardInterrupt from outer code X-Git-Tag: v15.1.1~358^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bad6cda2eb64cda082bed518f5115dd8c10c86f3;p=ceph.git 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 --- diff --git a/src/ceph.in b/src/ceph.in index 9b9012e71851..757551754531 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)