Commit 5b6ed07c authored by Zixian Cai's avatar Zixian Cai

Support redirecting stdout/stderr from subproc

parent 74ab41a9
......@@ -25,6 +25,9 @@ MONGODB_URI = "mongodb://{}:{}/{}".format(MONGODB_HOST,
MONGODB_PORT,
MONGODB_DATABASE)
# Executing
REDIRECT_SUBPROC = False
WEB_POI_REPO = "mu-impl-fast"
WEB_POI_HOST = "angus"
WEB_RESULT_DIR = "../results"
......
......@@ -66,6 +66,13 @@ def run_in_subproc(cmd, env=None, **kwds):
res = subproc.Popen(cmd, stdout=subproc.PIPE, stderr=subproc.PIPE,
env=env, **kwds)
so, se = res.communicate()
if settings.REDIRECT_SUBPROC:
print('---------------- stdout ----------------')
print(so)
print('---------------- stderr ----------------')
print(se)
res = SimpleNamespace(stdout=str(so, encoding='utf-8'),
stderr=str(se, encoding='utf=8'),
returncode=res.returncode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment