Special cased KeyboardInterrupt

This commit is contained in:
Brad Warren 2015-06-26 16:09:46 -07:00
parent e97719b367
commit d6246ae309
2 changed files with 9 additions and 1 deletions

View file

@ -676,10 +676,14 @@ def main(cli_args=sys.argv[1:]):
except errors.Error as error:
handle_exception_common()
return error
except: # pylint: disable=bare-except
except KeyboardInterrupt:
handle_exception_common()
# Ensures a new line is printed
return ""
except: # pylint: disable=bare-except
handle_exception_common()
return ("\nAn unexpected error occured. Please see the logfiles in {0} "
"for more details.".format(args.logs_dir))
if __name__ == "__main__":

View file

@ -72,6 +72,10 @@ class CLITest(unittest.TestCase):
self._call(['--debug'] + cmd_arg, attrs)
self._call(cmd_arg, attrs)
attrs['view_config_changes.side_effect'] = [ValueError]
with self.assertRaises(ValueError):
self._call(['--debug'] + cmd_arg, attrs)
self._call(cmd_arg, attrs)
if __name__ == '__main__':
unittest.main() # pragma: no cover