Code

Ticket #8235: popen.diff

File popen.diff, 777 bytes (added by kmtracey, 6 years ago)
Line 
1Index: tests/regressiontests/admin_scripts/tests.py
2===================================================================
3--- tests/regressiontests/admin_scripts/tests.py        (revision 8305)
4+++ tests/regressiontests/admin_scripts/tests.py        (working copy)
5@@ -106,7 +106,12 @@
6 
7         # Move to the test directory and run
8         os.chdir(test_dir)
9-        stdin, stdout, stderr = os.popen3(cmd)
10+        try:
11+            from subprocess import Popen, PIPE
12+            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
13+            stdin, stdout, stderr = (p.stdin, p.stdout, p.stderr)
14+        except ImportError:
15+            stdin, stdout, stderr = os.popen3(cmd)
16         out, err = stdout.read(), stderr.read()
17 
18         # Restore the old environment