summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-05-11 06:57:33 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-05-11 06:57:33 (GMT)
commit42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3 (patch)
tree27d7ad013999378e92e4a94742831cd2081f5359 /Lib/test/test_cmd_line.py
parent82be218e971725657af9b3231a0c467e99ade26f (diff)
downloadcpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.zip
cpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.tar.gz
cpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.tar.bz2
Deprecate os.popen* and popen2 module in favor of the subprocess module.
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r--Lib/test/test_cmd_line.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index cacae7a..d3f07c7 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -1,18 +1,19 @@
import test.test_support, unittest
import sys
-import popen2
import subprocess
class CmdLineTest(unittest.TestCase):
def start_python(self, cmd_line):
- outfp, infp = popen2.popen4('"%s" %s' % (sys.executable, cmd_line))
- infp.close()
- data = outfp.read()
- outfp.close()
+ cmd = '"%s" %s' % (sys.executable, cmd_line)
+ p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ p.stdin.close()
+ data = p.stdout.read()
+ p.stdout.close()
# try to cleanup the child so we don't appear to leak when running
# with regrtest -R. This should be a no-op on Windows.
- popen2._cleanup()
+ subprocess._cleanup()
return data
def exit_code(self, *args):