From 9f15f71eecac0b9314756de8612b302f24096437 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Wed, 28 Mar 2018 12:47:45 +0100 Subject: [sosreport] handle KeyboardInterrupt separately in execute() Exit on user cancel should use 130 (128 + SIGINT) as the exit status. Treat it separately from other top-level exceptions. Signed-off-by: Bryn M. Reeves --- sos/sosreport.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index ee33a9fa..effd5034 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1604,12 +1604,15 @@ class SoSReport(object): self.plain_report() self.postproc() self.version() - return self.final_work() except (OSError): self._cleanup() - except (SystemExit, KeyboardInterrupt): + except (KeyboardInterrupt): + self.ui_log.error("Exiting on user cancel") + self._cleanup() + self._exit(130) + except (SystemExit): self._cleanup() self._exit(0) -- cgit