From 430806a2bc1d11b60b867e0296e7200e17595cfc Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Tue, 19 Mar 2019 17:30:16 +0000 Subject: [sosreport] raise SystemExit out of list handlers Since the temporary directories have already been set up by the time we process the --list-* handling (plugins, profiles, presets), we still need to follow the _cleanup() path at exit. To avoid a duplicate _cleanup() and resulting File Not Found exception, raise SystemExit out of these paths, which takes us through the normal exception handling in SoSReport.execute() and is consistent with all other paths through the command. Resolves: #1594. Signed-off-by: Bryn M. Reeves --- sos/sosreport.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sos/sosreport.py b/sos/sosreport.py index 0d87ba95..d8c862db 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1455,13 +1455,13 @@ class SoSReport(object): if self.opts.list_plugins: self.list_plugins() - return True + raise SystemExit if self.opts.list_profiles: self.list_profiles() - return True + raise SystemExit if self.opts.list_presets: self.list_presets() - return True + raise SystemExit if self.opts.add_preset: return self.add_preset(self.opts.add_preset) if self.opts.del_preset: @@ -1501,6 +1501,5 @@ def main(args): """The main entry point""" sos = SoSReport(args) sos.execute() - sos._cleanup() # vim: set et ts=4 sw=4 : -- cgit