fix jython issue, flexibilize sysexec params

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-10-29 23:46:14 +01:00
parent 609776bf26
commit 6a82cdb37f
2 changed files with 4 additions and 3 deletions

View File

@ -542,14 +542,15 @@ class LocalPath(FSBase):
raise
return mod
def sysexec(self, *argv):
def sysexec(self, *argv, **popen_opts):
""" return stdout text from executing a system child process,
where the 'self' path points to executable.
The process is directly invoked and not through a system shell.
"""
from subprocess import Popen, PIPE
argv = map(str, argv)
proc = Popen([str(self)] + list(argv), stdout=PIPE, stderr=PIPE)
popen_opts['stdout'] = popen_opts['stderr'] = PIPE
proc = Popen([str(self)] + list(argv), **popen_opts)
stdout, stderr = proc.communicate()
ret = proc.wait()
if py.builtin._isbytes(stdout):

View File

@ -338,7 +338,7 @@ class TestImport:
def test_pyimport_check_filepath_consistency(self, monkeypatch, tmpdir):
name = 'pointsback123'
ModuleType = type(py.std.sys)
ModuleType = type(py.std.os)
p = tmpdir.ensure(name + '.py')
for ending in ('.pyc', '$py.class', '.pyo'):
mod = ModuleType(name)