[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:
parent
a8578c5cd3
commit
51e14dd1b0
|
@ -15,11 +15,12 @@ import sys
|
||||||
sys.path.insert(0, '.')
|
sys.path.insert(0, '.')
|
||||||
|
|
||||||
import py
|
import py
|
||||||
import os
|
import os, subprocess
|
||||||
|
|
||||||
def sysexec(cmd):
|
def sysexec(cmd):
|
||||||
print "executing", cmd
|
print "executing", cmd
|
||||||
os.system(cmd)
|
p = subprocess.Popen(cmd, shell=True)
|
||||||
|
os.waitpid(p.pid, 0)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pydir = py.path.local().join("py")
|
pydir = py.path.local().join("py")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
import os, inspect, socket
|
import os, inspect, socket
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
import sys
|
import sys
|
||||||
from py.magic import autopath ; mypath = autopath()
|
from py.magic import autopath ; mypath = autopath()
|
||||||
from py.__.misc.warn import APIWARN
|
from py.__.misc.warn import APIWARN
|
||||||
|
@ -56,7 +57,8 @@ class InstallableGateway(gateway.Gateway):
|
||||||
|
|
||||||
class PopenCmdGateway(InstallableGateway):
|
class PopenCmdGateway(InstallableGateway):
|
||||||
def __init__(self, cmd):
|
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
|
self._cmd = cmd
|
||||||
io = inputoutput.Popen2IO(infile, outfile)
|
io = inputoutput.Popen2IO(infile, outfile)
|
||||||
super(PopenCmdGateway, self).__init__(io=io)
|
super(PopenCmdGateway, self).__init__(io=io)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import py
|
import py
|
||||||
import sys, os, re
|
import sys, os, re
|
||||||
|
import subprocess
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
from distutils import core
|
from distutils import core
|
||||||
|
|
||||||
|
@ -147,7 +148,8 @@ def addbindir2path():
|
||||||
win32con.SMTO_ABORTIFHUNG, 5000)
|
win32con.SMTO_ABORTIFHUNG, 5000)
|
||||||
|
|
||||||
# Propagate changes to current command prompt
|
# 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):
|
def get_registry_value(reg, key, value_name):
|
||||||
k = _winreg.OpenKey(reg, key)
|
k = _winreg.OpenKey(reg, key)
|
||||||
|
|
|
@ -24,13 +24,13 @@ def posix_exec_cmd(cmd):
|
||||||
the error-output from the command.
|
the error-output from the command.
|
||||||
"""
|
"""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
import popen2
|
from subprocess import Popen, PIPE
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
#print "execing", cmd
|
#print "execing", cmd
|
||||||
child = popen2.Popen3(cmd, 1)
|
child = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
||||||
stdin, stdout, stderr = child.tochild, child.fromchild, child.childerr
|
close_fds=True)
|
||||||
stdin.close()
|
stdin, stdout, stderr = child.stdin, child.stdout, child.stderr
|
||||||
|
|
||||||
# XXX sometimes we get a blocked r.read() call (see below)
|
# XXX sometimes we get a blocked r.read() call (see below)
|
||||||
# although select told us there is something to read.
|
# although select told us there is something to read.
|
||||||
|
|
Loading…
Reference in New Issue