This avoids getting random tracebacks when you control-C early in the
process.
Signed-off-by: Sage Weil <sage@redhat.com>
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)