[svn r61954] removed of using some deprecated modules/functions from stdlib.

used subprocess instead (the module is included to stdlib since 2.4)

--HG--
branch : trunk
This commit is contained in:
getxsick 2009-02-16 20:30:14 +01:00
parent a8578c5cd3
commit 51e14dd1b0
4 changed files with 13 additions and 8 deletions

View File

@ -15,11 +15,12 @@ import sys
sys.path.insert(0, '.')
import py
import os
import os, subprocess
def sysexec(cmd):
print "executing", cmd
os.system(cmd)
p = subprocess.Popen(cmd, shell=True)
os.waitpid(p.pid, 0)
if __name__ == '__main__':
pydir = py.path.local().join("py")

View File

@ -1,5 +1,6 @@
import os, inspect, socket
from subprocess import Popen, PIPE
import sys
from py.magic import autopath ; mypath = autopath()
from py.__.misc.warn import APIWARN
@ -56,7 +57,8 @@ class InstallableGateway(gateway.Gateway):
class PopenCmdGateway(InstallableGateway):
def __init__(self, cmd):
infile, outfile = os.popen2(cmd)
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
infile, outfile = p.stdin, p.stdout
self._cmd = cmd
io = inputoutput.Popen2IO(infile, outfile)
super(PopenCmdGateway, self).__init__(io=io)

View File

@ -1,5 +1,6 @@
import py
import sys, os, re
import subprocess
from distutils import sysconfig
from distutils import core
@ -147,7 +148,8 @@ def addbindir2path():
win32con.SMTO_ABORTIFHUNG, 5000)
# Propagate changes to current command prompt
os.system("set PATH=%s" % path)
p = subprocess.Popen("set PATH=%s" % path, shell=True)
os.waitpid(p.pid, 0)
def get_registry_value(reg, key, value_name):
k = _winreg.OpenKey(reg, key)

View File

@ -24,13 +24,13 @@ def posix_exec_cmd(cmd):
the error-output from the command.
"""
__tracebackhide__ = True
import popen2
from subprocess import Popen, PIPE
import errno
#print "execing", cmd
child = popen2.Popen3(cmd, 1)
stdin, stdout, stderr = child.tochild, child.fromchild, child.childerr
stdin.close()
child = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True)
stdin, stdout, stderr = child.stdin, child.stdout, child.stderr
# XXX sometimes we get a blocked r.read() call (see below)
# although select told us there is something to read.