aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2018-03-28 12:47:45 +0100
committerBryn M. Reeves <bmr@redhat.com>2018-03-28 12:47:45 +0100
commit9f15f71eecac0b9314756de8612b302f24096437 (patch)
tree59f70be066e7cc9a37303053bd05699d9a73198b
parent0677ff04822aff11b124d42c2d4b6a6cea66b7d3 (diff)
downloadsos-9f15f71eecac0b9314756de8612b302f24096437.tar.gz
[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 <bmr@redhat.com>
-rw-r--r--sos/sosreport.py7
1 files 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)