diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 2c8fa192137..0f3f09e6db1 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -1119,20 +1119,22 @@ class BlackboxTestCase(TestCaseInTempDir): stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - retcode = p.wait() + stdoutdata, stderrdata = p.communicate() + retcode = p.returncode if retcode != expected: raise BlackboxProcessError(retcode, line, - p.stdout.read(), - p.stderr.read()) + stdoutdata, + stderrdata) def check_output(self, line): line = self._make_cmdline(line) p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True) - retcode = p.wait() + stdoutdata, stderrdata = p.communicate() + retcode = p.returncode if retcode: - raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read()) - return p.stdout.read() + raise BlackboxProcessError(retcode, line, stdoutdata, stderrdata) + return stdoutdata def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None,