def pyrun(src):
"""Run python code 'src' in a separate interpreter.
Return subprocess exit code.
"""
if PY3:
src = bytes(src, 'ascii')
with tempfile.NamedTemporaryFile(suffix='.py', delete=False) as f:
f.write(src)
f.flush()
test_files.append(f.name)
code = subprocess.call(
[sys.executable, f.name],
stdout=None, stderr=None,
# creationflags=subprocess.CREATE_NEW_PROCESS_GROUP
)
return code
评论列表
文章目录