From 0677ff04822aff11b124d42c2d4b6a6cea66b7d3 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Wed, 28 Mar 2018 12:45:59 +0100 Subject: [sosreport] log exception detail when waiting on user input If we catch an exception while waiting on user input, exit with status 130 if the exception is KeyboardInterrupt, otherwise log the exception text and exit with the exception as the status. Signed-off-by: Bryn M. Reeves --- sos/sosreport.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index 02d9b21c..ee33a9fa 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1176,9 +1176,13 @@ class SoSReport(object): msg += _("Press ENTER to continue, or CTRL-C to quit.\n") try: input(msg) - except Exception as err: + except KeyboardInterrupt as e: + self.ui_log.error("Exiting on user cancel") + self._exit(130) + except Exception as e: self.ui_log.info("") - self._exit(err) + self.ui_log.error(e) + self._exit(e) def _log_plugin_exception(self, plugin, method): trace = traceback.format_exc() -- cgit