From dd47bcd2105c7de36520b1477f9f51926b5da58f Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 3 Feb 2017 17:18:47 +0530 Subject: run_unittests: Support returning the output of a subprocess --- run_unittests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index e8d475119..1e9aa5b0d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -202,9 +202,12 @@ class BasePlatformTests(unittest.TestCase): os.environ = self.orig_env super().tearDown() - def _run(self, command): - self.output += subprocess.check_output(command, stderr=subprocess.STDOUT, - env=os.environ.copy()) + def _run(self, command, return_output=False): + output = subprocess.check_output(command, stderr=subprocess.STDOUT, + env=os.environ.copy()) + self.output += output + if return_output: + return output def init(self, srcdir, extra_args=None, default_args=True): if extra_args is None: -- cgit v1.2.1