diff options
-rw-r--r-- | sos/report/__init__.py | 6 | ||||
-rw-r--r-- | tests/sos_tests.py | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sos/report/__init__.py b/sos/report/__init__.py index e0617b45..249ff119 100644 --- a/sos/report/__init__.py +++ b/sos/report/__init__.py @@ -1541,13 +1541,15 @@ class SoSReport(SoSComponent): except (OSError): if self.opts.debug: raise - self.cleanup() + if not os.getenv('SOS_TEST_LOGS', None) == 'keep': + self.cleanup() except (KeyboardInterrupt): self.ui_log.error("\nExiting on user cancel") self.cleanup() self._exit(130) except (SystemExit) as e: - self.cleanup() + if not os.getenv('SOS_TEST_LOGS', None) == 'keep': + self.cleanup() sys.exit(e.code) self._exit(1) diff --git a/tests/sos_tests.py b/tests/sos_tests.py index a1c68353..b7f7243c 100644 --- a/tests/sos_tests.py +++ b/tests/sos_tests.py @@ -121,7 +121,8 @@ class BaseSoSTest(Test): """ exec_cmd = self._generate_sos_command() try: - self.cmd_output = process.run(exec_cmd, timeout=self.sos_timeout) + self.cmd_output = process.run(exec_cmd, timeout=self.sos_timeout, + env={'SOS_TEST_LOGS': 'keep'}) except Exception as err: if not hasattr(err, 'result'): # can't inspect the exception raised, just bail out |