diff --git a/subprocess2.py b/subprocess2.py index 364aace886..1f9c6c99e3 100644 --- a/subprocess2.py +++ b/subprocess2.py @@ -355,7 +355,6 @@ class Popen(subprocess.Popen): self._tee_threads(input) if stdout is not None: stdout = ''.join(stdout) - stderr = None if stderr is not None: stderr = ''.join(stderr) return (stdout, stderr) diff --git a/tests/subprocess2_test.py b/tests/subprocess2_test.py index 917e106af6..9d7df5bed2 100755 --- a/tests/subprocess2_test.py +++ b/tests/subprocess2_test.py @@ -326,6 +326,14 @@ class RegressionTest(BaseTestCase): self._check_res(res, None, None, 0) self._run_test(fn) + def test_stderr(self): + cmd = ['expr', '1', '/', '0'] + p1 = subprocess.Popen(cmd, stderr=subprocess.PIPE) + p2 = subprocess2.Popen(cmd, stderr=subprocess.PIPE) + r1 = p1.communicate() + r2 = p2.communicate(timeout=100) + self.assertEquals(r1, r2) + class S2Test(BaseTestCase): # Tests that can only run in subprocess2, e.g. new functionalities.