aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2020-02-14 16:14:29 +0000
committerBryn M. Reeves <bmr@redhat.com>2020-02-14 16:14:29 +0000
commitafd6c59afca7cea11c13ea65a5d1ab428fa42cc3 (patch)
treeec10315feab575054311184f93f12515096a0a79
parenta1577563ad39ad35070b1ea44ea6fe3f0613d6b9 (diff)
downloadsos-afd6c59afca7cea11c13ea65a5d1ab428fa42cc3.tar.gz
[sosreport] fix exit status propagation
Exits that trap to the SystemExit handler in SoSReport.execute() re-set the exit code passed returned by the process. Catch the exception as 'e' and use e.code to pass on the correct value. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/sosreport.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2d2d1599..71e7725c 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -1386,9 +1386,9 @@ class SoSReport(object):
self.ui_log.error("\nExiting on user cancel")
self._cleanup()
self._exit(130)
- except (SystemExit):
+ except (SystemExit) as e:
self._cleanup()
- self._exit(0)
+ sys.exit(e.code)
self._exit(1)