handles keyboard interrupt

When an user intentionally provides an keyboard interrupt, ironicclient
throws the entire traceback on to the terminal instead of handling it.
ironicclient will now handle the keyboard interrrupt and provides an crisp
message on to the terminal.

Change-Id: I8e657dc0cf64fa3396fb8fd32c5ffb57016ce864
Closes-Bug: #1367283
This commit is contained in:
Rakesh H S 2014-09-11 17:17:39 +05:30
parent 0a6ec955c0
commit ad8c27f8e0
1 changed files with 3 additions and 1 deletions

View File

@ -288,7 +288,9 @@ class HelpFormatter(argparse.HelpFormatter):
def main():
try:
IronicShell().main(sys.argv[1:])
except KeyboardInterrupt:
print("... terminating ironic client", file=sys.stderr)
sys.exit(130)
except Exception as e:
print(str(e), file=sys.stderr)
sys.exit(1)