Catch KeyboardInterrupt
When a user Ctrl-C's the client, this will cause a short message to be printed rather than an ugly backtrace. This will not catch all instances of this (can still Ctrl-C before reaching this code, etc.), but it should catch most of them, and those for long-running sessions. The specific message was chosen to match one recently added to the glance client. Change-Id: Ib748835ad1f94fb901b4941dc5e3797b719e197f
This commit is contained in:
@@ -487,7 +487,9 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
|
||||
def main():
|
||||
try:
|
||||
OpenStackCinderShell().main(sys.argv[1:])
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print >> sys.stderr, "... terminating cinder client"
|
||||
sys.exit(130)
|
||||
except Exception, e:
|
||||
logger.debug(e, exc_info=1)
|
||||
print >> sys.stderr, "ERROR: %s" % e.message
|
||||
|
||||
Reference in New Issue
Block a user